Tuesday, July 24, 2012

Javascript datestring constructor changes timezone



I have a string Date in this format:



\”2012-07-22T08:00:00Z\”



But when i try to create a date from that string:



new Date(\"2012-07-22T08:00:00Z\");


I get:



Date {Sun Jul 22 2012 01:00:00 GMT-0700}



Looks like it\’s changing the timezone of the date to local timezone. Because it\’s reducing the time in 7 hours (GMT-0700)


How can i keep the date object with utc and in the right time (08:00:00)?


Thanks in advance!!!






Rating: 2 out of 5 based on 3 ratings



The post Javascript datestring constructor changes timezone appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/javascript-datestring-constructor-changes-timezone.html

No comments:

Post a Comment