Reputation: 4606
Could someone explain me, why I get 12 Februray when running the code below?
I saw the days are from 1 to 31, only the months starts with 0
var d = new Date(2100,1,13)
> d
Fri, 12 Feb 2100 23:00:00 GMT
EDIT:
And why this time?? 23:00:00
it should be 00:00:00
Upvotes: 6
Views: 5159
Reputation: 11751
Your locale timezone is interfering. Try: new Date(Date.UTC(2100,1,13))
.
Upvotes: 9
Reputation: 2260
The output is based on the GMT zone and not as per your time zone. Adjust your system time to proper time zone, you should be getting correct output. Hope that helps.
Upvotes: 1