So, this is driving me nuts and I’m not sure if it’s a bug or if I’m missing something obvious. Can someone please explain to me why a month is added to the following statement in mongo 2.0.2
# mongo
MongoDB shell version: 2.0.2
> new Date()
ISODate("2012-02-19T04:58:56.988Z")
> new Date(2012, 02, 19, 04, 58, 56)
ISODate("2012-03-19T04:58:56Z")
> new Date(2012, 01, 19, 04, 58, 56)
ISODate("2012-02-19T04:58:56Z")
Notice how a month is added when I specify the date. Whiskey Tango Foxtrot?
MongoDB uses JavaScript as its interface language. The
monthin the JavaScript Date constructor is zero based. From the fine manual:Note the 0 for January. This sort of thing is one of the reasons that MongoDB tends to use their own
ISODatefunction instead ofnew Date: