Skip to content

Instantly share code, notes, and snippets.

@m-thirumal
Last active November 22, 2023 11:22
Show Gist options
  • Save m-thirumal/94cc1f567a74caff50f92b2d99c27127 to your computer and use it in GitHub Desktop.
Save m-thirumal/94cc1f567a74caff50f92b2d99c27127 to your computer and use it in GitHub Desktop.
How to handle different timezone with Daylight Saving Time (DST) in JAVA?

Worldwide DST zones change very often and there’s no central authority coordinating it.

A country, or in some cases even a city, can decide if and how to apply or revoke it.

Everytime it happens, the change is recorded in the IANA Time Zone Database, and the update will be rolled out in a future release of the JRE.

We can force the modified Time Zone data containing the new DST settings into the JRE through Java Time Zone Updater Tool,

Steps

  1. Download the latest updater and latest tzdata from https://www.iana.org/time-zones
  2. Stop all JRE application.
  3. Run the following command to update
sudo java -jar ziupdater-1.1.1.1.jar -V -l file:///Users/thirumal/Downloads/tzdata2023c.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment