I have a string, and I have converted it into a Date variable. But the timezone is turning out to be wrong.
The string I\'m trying to use is :
var v
2013/09/05 17:53 -05:00
is the same time as Thu Sep 05 2013 18:53:00 GMT-0400
; both are Thu, 05 Sep 2013 22:53:00 GMT
In JavaScript, you have two choices (natively) about how to display a time; in the local machine's timezone (Date.prototype.toString
) or in UTC (Date.prototype.toUTCString
). If you want to display a time as a string with a different time zone, you will have to write a function to do it manually, calculating it from UTC.
The two main articles on MDN which will help you with how to use a Date are Date and Date.prototype.