PDA

View Full Version : Date.format does not return correct timezone on IE



nmandya
21 May 2012, 11:21 PM
Hi,
If I use new Date().format("T"), I find that I always get UTC as the value of the local host's timezone irrespective of the timezone the local host is in. However, Firefox and Chrome return the right values. Even on IE, if the host timezone is set to something in the USA like EST or PST, then the right value is returned.

However, if the timezone is set to something like India or Australia, then the vale returned is always UTC. Why is this?

I have noticed that there are differences in what new Date().toString() returns on the different browsers.

Firefox: new Date().toString() = "Tue May 22 2012 17:17:47 GMT+1000 (AUS Eastern Standard Time)"
IE: new Date().toString() = "Tue May 22 17:18:23 UTC+1000 2012"
Chrome: new Date().toString() = "Tue May 22 2012 17:19:48 GMT+1000 (AUS Eastern Standard Time)"

Is the behaviour of T format character different on IE because of the way IE returns the string value?
--

scottmartin
3 Jun 2012, 4:36 PM
Does toGMTString() work? IE is always on the left side of the right way of doing things.

Scott.