The following code
var date = new Date();
console.log( date );
gives me
Sun Mar 06 2011 21:41:36 GMT+1300 (NZST) {}
in Firefox, but
Sun Mar 06 2011 21:40:51 GMT+1300 (NZDT)
in Safari (which is correct).
My system Date & Time is set to NZDT, so I'm wondering where firefox is getting its NZST from. Mind you, the UTC offset (+1300) is correct in both cases.
How can I get Firefox displaying the correct timezone: NZDT?
You shouldn't rely on that output as it's different in other browsers (IE), instead you should use the getTimezoneOffset method.
var date = new Date;
console.log( date.getTimezoneOffset() );
The offset will change with day light savings but there are ways to work with this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With