September 2019
Intermediate to advanced
816 pages
18h 47m
English
The new Java date-time API provides new leverages for solving this problem.
At the first step, the available time zones IDs can be obtained via the ZoneId class, as follows:
Set<String> zoneIds = ZoneId.getAvailableZoneIds();
At the second step, each time zone ID should be used to create a ZoneId instance. This can be accomplished via the ZoneId.of(String zoneId) method:
ZoneId zoneid = ZoneId.of(current_zone_Id);
At the third step, each ZoneId can be used to obtain the time that is specific to the identified zone. This means that a "lab rats" reference date-time is needed. This reference date-time (without a time zone, LocalDateTime.now()) is combined with the given time zone (ZoneId), via LocalDateTime.atZone(), in ...