Why does the month argument range from 0 to 11 in JavaScript's Date constructor?

Posted by Agnel Kurian on Stack Overflow See other posts from Stack Overflow or by Agnel Kurian
Published on 2010-03-31T11:34:35Z Indexed on 2010/03/31 11:43 UTC
Read the original article Hit count: 229

Filed under:
|
|

When initializing a new Date object in JavaScript using the below call, I found out that the month argument counts starting from zero.

new Date(2010, 3, 1);  // that's the 1st April 2010!

Why does the month argument start from 0? On the other hand, the day of the month argument (last one) is a number from 1 to 31. Are there good reasons for this?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about date