April 4, 2009

Handling Different timezones in distributed environment

This was a captivating discussion on how timezones in distributed environment should be handled. There are a couple of good strategies recommended.

Scenario:
Having db server in different time zone and process server / engine, which is going to run lively like auctions/bidding in different time zone.

Recommended Solution

Store dates in GMT format and format them as required at the various endpoints.
  • User prefered timezone - used whenever date displayed to user, entered by user and validated.
  • User machine timezone - could be used to determine user preferred timezone and local logging in case of rich client
  • Server timezone - used for local logging
  • Database timezone - should be irrelevant.
  • Common timezone (GMT normally but it does not really matter) - used for dates stored in database, interserver communication, centralized logging, etc)

No comments: