> d
Thu Feb 27 2020 17:05:28 GMT-0600 (Central Standard Time)
> d.getMonth()
1
I'm as fond of zero-indexing as anyone, but this is ridiculous. > d
Thu Feb 27 2020 17:05:28 GMT-0600 (Central Standard Time)
> d.getMonth()
1
I'm as fond of zero-indexing as anyone, but this is ridiculous.Hindsight really is 20/20.
Can you elaborate on this? Was netscape owned/funded by Sun?
It occurs to me that "9/11" is the one date I can think of where the month is commonly verbally referred to by its number.
1970-01-01T00:00:00 is the start of the Unix Epoch, it is definitely not 1970-00-01T00:00:00.
This is consistent across all the warty and various ways to represent the Gregorian calendar, the fifth month is always May, no exceptions.
> I get my check on the first of the month
But never really say
> I'm going on vacation for the sixth (month) of the year
Seems like they are just trying to explain the bad decision, not justify it.
The bigger WTF is getYear(), which returns the year minus 1,900.
You forgot about east asian languages, which all use numeral months.
https://en.wikipedia.org/wiki/Chinese_calendar#Month
I don't know whether JS is fast-evolving or slow-evolving.
ISO 8601 has a sensible date format which is an international standard. Gregorian calendar, YYYY-MM-DD, with MM from 01 to 12, and DD from 01 to 31. Days of the week are from 1 to 7, beginning with Monday.
java.util.Date has since been superseded by classes in java.time, which uses ISO 8601.
> d.getDay()
4 // that's the weekday, use getDate()
> d.getYear()
120 // that's the year minus 1900, use getFullYear()