Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Date.UTC(2015, 08, 31) == Date.UTC(2015, 09, 01) in javascript?

Tags:

javascript

utc

My script broke up after yesterday because both Date.UTC(2015, 08, 31) and Date.UTC(2015, 09, 01) provides same timestamp 1443657600000.

This is the only pair of days which provide same result. what am I missing?

like image 968
Ondra Maly Avatar asked Dec 25 '22 15:12

Ondra Maly


1 Answers

The month parameter is zero-indexed. So 8 is actually september which only has 30 days. So it flows over to october.

Reference: Date.UTC()

like image 198
Yoshi Avatar answered Jan 05 '23 01:01

Yoshi