Search code examples
javadatabasetimezoneversiontzdata

Get the current version number of `tzdata`


Oracle provides the TZUpdater tool to manually update the version of the tzdata time zone data bundled with the JVM.

👉🏽 How to programmatically determine the version number of the time zone data currently installed in a JVM?

I want to compare that to the current release stated on the official IANA page, Time Zone Database.


Solution

  • Use the ZoneRulesProvider class.

    System.out.println(java.time.zone.ZoneRulesProvider.getVersions("UTC").keySet());
    

    For me, using 1.8.0_91, it prints [2016a].