Javascript, Timezones and Google Mail

Posted on Tuesday, June 23, 2009 by Nicki

Google hosts the email for my domain, and I've always had an issue with the times of messages in the message list displaying incorrectly. I just ignored it for a while, but then it became too irritating to ignore anymore.


The correct time was displayed in IE, but not in FireFox and Google Chrome. Creating a test.html page containing a script tag with the instruction alert(new Date()) showed the differences.

I browsed the Google Help forums for assistance, and the suggestions I found did not help. I found a thread that could be relevant (http://www.google.com/support/forum/p/Google+Apps/thread?tid=68f2eb265a1e0d8b&hl=en) and followed on the postings. After trying a couple of things, bkenelly suggested that I have a look for the TZ environment variable, as the Timezone setting (via double-clicking on the clock) was correct.

There was no TZ environment variable set under My Computer / Properties / Advanced / Environment variables, but executing the SET command in a Command Prompt showed that TZ was defined as CAT2. This caused the mysterious 4h difference. After defining TZ to GMT-2 and restarting Chrome, the time was correct. Hooray!!!

0 Responses to "Javascript, Timezones and Google Mail":