Skip to content Skip to sidebar Skip to footer

Stop Javascript Datetime Adjusting To Local Time Zone

I am receiving the correct unix time that I use in my html page in my javascript. However, when I view or alert the unixtime, what happens is that the date is adjusted based on my

Solution 1:

If you want the UTC format you can use one of the many UTC methods. For instance you could use Date.prototype.toUTCString:

var unixTS = 1434203820 * 1000; // JS date is in millsecondsvar date = newDate(unixTS);

document.write(date.toUTCString());

Solution 2:

Maybe what you want is converting back the timestamp to UTC format ?

How do you convert a Javascript timestamp into UTC format?

Post a Comment for "Stop Javascript Datetime Adjusting To Local Time Zone"