datetime - JavaScript time is an hour behind after ISO conversion -
i create new date in javascript, correct time, after use toisostring()
convert it, it's hour behind. why be?
https://jsfiddle.net/73nfyxel/
var createddatetime = new date('2015-04-01 11:53:00'); var isocreateddatetime = ""; alert(createddatetime); isocreateddatetime = createddatetime.toisostring().match(/(\d{4}\-\d{2}\-\d{2})t(\d{2}:\d{2}:\d{2})/); alert(isocreateddatetime[1] + ' ' + isocreateddatetime[2]); createddatetime.setminutes(createddatetime.getminutes() + 1);
as far i'm aware should immune changes local time (eg. daylight savings), i'm giving pre-set time, , not timezone. what's going on?
the toisostring
method doesn't format date, first converted utc.
the difference between local time zone , utc 1 hour.
Comments
Post a Comment