June 2018
Beginner
722 pages
18h 47m
English
The class LocalDate does not carry time. It represents a date in ISO 8601 format, yyyy-MM-DD:
System.out.println(LocalDate.now()); //prints: 2018-04-14
As you can see, the method now() returns the current date as it is set on your computer: April 14, 2018 was the date when this section was written.
Similarly, you can get the current date in any other timezone using the static method now(ZoneId zone). The ZoneId object can be constructed using the static method ZoneId.of(String zoneId), where String zoneId is any of the String values returned by the method ZonId.getAvailableZoneIds():
Set<String> zoneIds = ZoneId.getAvailableZoneIds();for(String zoneId: zoneIds){ System.out.println(zoneId); }
This code prints many timezone ...
Read now
Unlock full access