0
Mistake
In third example â//Sat Jun 11 1988 11:42:00 var d3 = new Date(88,5,11,11,42,0,0);â I think the month should be May instead of June, or am I wrong?
5 Respostas
+ 2
The Date object in JavaScript uses 0 through 11 for months. This means 0 represents January and 11 represents December.
Its a little confusing, but thats how its implemented.
Hope that clarified things.
0
Again, what are you referring to?
https://www.sololearn.com/discuss/1316935/?ref=app
0
i got it, I am mistaken, as javascript uses strange numbers for months in the Date objects. number 5 actually (although strangely) represents June instead of May.
0
yes, correct, still it is confusing for me that date starts at 1, but month starts at 0
0
I agree, but mostly I just think of it as indexes in arrays. If you were to add 12 months to an array your index would be from 0 to 11 by default.
A lot of other languages donât do it this way and prefer the more life like 1 through 12.