Does anyone has any idea why
new Date('2012','1','1')
returns 1 february 2012 instead of 1 january?
and
new Date('2012','0','1')
will return 1 January 2012
Is this weird or logical?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because that’s exactly what section 15.9.1.4 of the ECMAscript specification (3rd edition) says should happen. 0=Jan, 1=Feb, … 11=Dec.
http://www.ecma-international.org/publications/standards/Ecma-262.htm