Home:ALL Converter>timezone issue with javascript date

timezone issue with javascript date

Ask Time:2013-08-07T14:51:24         Author:James Radford

Json Formatter

got a timezone issue with a javascript date which displays the day before when changing the timezone from GMT to EST. I've imported momentjs to help with this although my attempt is failing with the following code. any suggestions?

original code is

thisDate = new Date(myVar);  // original

New attempt to correct the timezone difference.

thisDate = moment(thisDate).utc().format();

Many thanks,

UPDATE

var myDate = new Date(myVar);
var displayDate = moment(myDate).zone('+0100').format('YYYY-MM-DD HH:mm');

Author:James Radford,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/18096507/timezone-issue-with-javascript-date
yy