Home > Java, Linux > Timezone Hell

Timezone Hell

If you haven’t had fun with timezones before, you haven’t developed enough software :)

For several of our applications we had a timezone consistency problem.  There is lots of information on the net about Timezones and Java – don’t forget your operating system and physical BIOS time settings.  Our production machines are set to EST5EDT (Eastern Standard Time – No Day Light Savings).

To set the applications to use this timezone, java needs to be told.  The easiest way is to add a parameter to the startup script

java -Duser.timezone=EST5EDT ....

Now all of our components agree (OS / BIOS / Java) that the timezone is EST5EDT or  GMT-5.

Next up will be setting all of the servers to GMT (which we should have done from the start years ago).  All of the applications should store dates in GMT and only translate into the correct format based on the users preferences.  For most of our applications (which are multi-tenant) we are going to set the timezone at the tenant level.  So if you want your times to be in EST, then they can be.  If another tenant wants their time in PST, that will work also.

We have a lot of the plumbing in place to do this.  The only piece left to work on is reporting.  Since reports are generated directly against the DB, a method needs to be determined to convert them to the tenants prefered TZ.

 
Categories: Java, Linux
  1. No comments yet.
  1. No trackbacks yet.

Spam Protection by WP-SpamFree