<script type="text/javascript">
alert(new Date(2010,8,31));
alert(new Date(2010,9,1));
</script>
Try the code above. The browser display the same date in both message. Why???
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.
Date(2010,8,31) means “October 1, 2010” and
Date(2010,9,1) also means “October 1, 2010”
Because
in Date(yyyy,mm,dd), mm can be set from 0 to 11 not from 1 to 12
so that if mm is 8 means august and august have 30 days.
on this case, if you input 31 in dd, it points “August 30” + 1