New date and ISO date conversion in Mongo shell

I tried mongoExport with some date condition, I read here , the date of which should be in the epoch-making format.

Question:

I tried below

> new Date(2013,10,16) ISODate("2013-11-16T00:00:00Z") 

Assuming I gave Oct-16-2013, but he returned me "2013-11-16". Same thing with the epoch format.

 > new Date(2013,10,16)*1 1384560000000 > > new Date(1384560000000) ISODate("2013-11-16T00:00:00Z") 

Could you help, why is his change of the month to 11?

+6
source share
1 answer

The month parameter of the JavaScript Date constructor is based on 0. So there is 0 for January-November for December, which is 9 for October, not 10.

+8
source

All Articles