Subtle Time Zone Bugs

Time zones are a frustratingly subtle source of bugs. If you haven’t dealt extensively with dates and times in your day-to-day programming, it’s easy to not be specific with time zones and let these bugs creep in.

For example, a user in Pacific Standard Time can submit a form that requires a date. If your server is running in Eastern Standard Time and no time zones have been specified, that date will be parsed incorrectly for three hours[1] every day.

Check It

A basic, but by no means thorough, check to see if you have time zone problems is to run your automated test suite in another time zone. If you get failures, it’s time to investigate.

One Solution

A simple way to fix this is to have the client submit the time zone along with the date and convert that object into the desired time zone on the server.


  1. The offset of the client and server time zones

Published Feb 25, 2013