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
Your locale timezone is interfering. Try: new Date(Date.UTC(2100,1,13))
.
You are setting 13 Feb 2100 CET and getting output in GMT.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With