I want to convert a date string to Date using javascript, use this code:
var date = new Date('2013-02-27T17:00:00'); alert(date);
'2013-02-27T17:00:00' is the UTC time in the JSON object from the server.
But the result of the above code is different from Firefox and Chrome:
Firefox returns:
Wed Feb 27 2013 17:00:00 GMT+0700 (SE Asia Standard Time)
Return Chrome:
Thu Feb 28 2013 00:00:00 GMT+0700 (SE Asia Standard Time)
Different 1 day, the correct result that I expect is the result of using Chrome.
Demo Code: http://jsfiddle.net/xHtqa/2/
How can I fix this problem to get the same result from both?
javascript date timezone
Cuong Le Feb 27 '13 at 10:36 2013-02-27 10:36
source share