I am wondering why the date of the constructor and the printed date is different. It is shown as a month late.
Asked
Active
Viewed 134 times
-2
-
1possible duplicate of [javascript is creating date wrong month](http://stackoverflow.com/questions/12254333/javascript-is-creating-date-wrong-month) and http://stackoverflow.com/q/25288781/1612146 and http://stackoverflow.com/q/19244052/1612146 and http://stackoverflow.com/questions/10649036/creating-date-with-numbers-new-date2012-03-gives-wrong-month-1 -- The list goes on. – George Jul 21 '15 at 15:33
-
1Because `Integer value representing the month, beginning with 0 for January to 11 for December.` https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date – Tushar Jul 21 '15 at 15:34
2 Answers
8
Month is zero-based in many languages. This means
0 -> January
1 -> February
2 -> March
...
month
Integer value representing the month, beginning with 0 for January to 11 for December.
Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
3
See reference: Date object
month
Integer value representing the month, beginning with 0 for January to 11 for December.

initall
- 2,385
- 19
- 27