How does the java.time API detect government zone rule changes?

I do not live in a country using DST.

  • I save future LocalDateTime offset from UTC and ZoneId to DB
  • The government of this zone changes the rules of DST
  • This future time I will LocalDateTime in this zone

If I used ZoneId and Offset to get LocalDateTime in this zone, how to do the java.time API correctly? How does he know that the government is changing the rules? Does this update get from the Internet?

+7
java datetime time dst java-time
source share
1 answer

Time zone updates usually come with JRE updates. Whenever the time zone of a particular territory changes, this information is included in the next version of the JRE.

Here you can find some time zone information for the JRE / JDK.

If updating the JRE / JDK is not an option, the TZUpdater tool can be used to update only time zone data without updating the JRE / JDK.

All Java date and time APIs that support time zones implicitly use JRE time zone data, so you only need to worry about the time zone data in the JRE being updated.

+5
source share

All Articles