Java Date Time Java Java API
java.time.LocalDate
public static LocalDate now()
Returns the current local date instance from the system clock in the default time-zone.
public static LocalDate now(ZoneId zone)
Returns the current local date instance from the system clock in the specified time-zone
public static LocalDate now(Clock clock)
Returns the current local date instance from the provided Clock.
package com.logicbig.example.localdate;import java.time.LocalDate;public class NowExample { public static void main (String... args) { LocalDate d = LocalDate.now(); System.out.println(d); }}
2017-05-01
package com.logicbig.example.localdate;import java.time.LocalDate;import java.time.ZoneId;public class NowExample2 { public static void main (String... args) { LocalDate d = LocalDate.now(ZoneId.of("Pacific/Kiritimati")); System.out.println(d); }}
2017-05-02
package com.logicbig.example.localdate;import java.time.Clock;import java.time.LocalDate;import java.time.ZoneId;public class NowExample3 { public static void main (String... args) { LocalDate d = LocalDate.now( Clock.tickSeconds(ZoneId.of("Japan"))); System.out.println(d); }}