admin管理员组文章数量:1315851
I was trying mongoExport with some date condition, I read here that date has to be in epoch format.
Question is,
I tried below,
> new Date(2013,10,16)
ISODate("2013-11-16T00:00:00Z")
Assuming that I gave Oct-16-2013, But it returned me '2013-11-16'. Same with epoch format also.
> new Date(2013,10,16)*1
1384560000000
>
> new Date(1384560000000)
ISODate("2013-11-16T00:00:00Z")
Can you please help, why its changing the month to 11 ?
I was trying mongoExport with some date condition, I read here that date has to be in epoch format.
Question is,
I tried below,
> new Date(2013,10,16)
ISODate("2013-11-16T00:00:00Z")
Assuming that I gave Oct-16-2013, But it returned me '2013-11-16'. Same with epoch format also.
> new Date(2013,10,16)*1
1384560000000
>
> new Date(1384560000000)
ISODate("2013-11-16T00:00:00Z")
Can you please help, why its changing the month to 11 ?
Share Improve this question edited May 23, 2017 at 12:00 CommunityBot 11 silver badge asked Jan 10, 2014 at 0:35 Srivatsa NSrivatsa N 2,3214 gold badges24 silver badges37 bronze badges1 Answer
Reset to default 8The month
parameter of JavaScript's Date
constructor is 0-based. So 0 for January to 11 for December, making it 9 for October instead of 10.
本文标签: javascriptNew Date and ISO Date conversion in Mongo shellStack Overflow
版权声明:本文标题:javascript - New Date and ISO Date conversion in Mongo shell - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741986830a2408730.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论