Anyone knows why this happens? I read (from a database) a date (2016-10-05), but Javascript create the object like 2016-10-04. Can be anything related to the timezone? Can someone point me to some source that let me help to figure it this? (I have search, but to be honest, not knowing what the issue is, it's difficult to look for more info)
Asked
Active
Viewed 1,163 times
-3
-
The reason for this is that the [*TC39 committee*](https://github.com/tc39/ecma262/issues/87) decided that ISO 8601 format date only strings should be parsed as UTC, whereas ISO 8601 requires them to be parsed as local. – RobG Oct 13 '16 at 22:44
2 Answers
2
The time you've specified is at midnight GMT or 0 hours. The EDT timezone is 4 hours behind GMT, so when you convert the time to the EDT timezone (your local timezone), it's -4 hours into the previous day.

Soviut
- 88,194
- 49
- 192
- 260
0
I find some info in MDN Date page, use the d.toUTCString()
method can turn to GMT.
var d = new Date('2016-10-05T00:00:00.000+0000');
d.toUTCString();
return "Wed, 05 Oct 2016 00:00:00 GMT"
Hope this can help you

g1eny0ung
- 1,761
- 3
- 14
- 17