【发布时间】:2018-03-17 14:36:38
【问题描述】:
在 mongodb 中,我有一些日期存储在 ISODate 中,例如:
ISODate("2017-02-06T18:04:34.954+0000")
通过使用 foo = new Date();但是,在某些情况下,它会显示为字符串:
"2017-10-05T20:33:59.453Z"
有没有办法使用 JavaScript 获得上面显示的 ISODate("2017-02-06T18:04:34.954+0000") 结果的一致性?
【问题讨论】:
-
使用momentjs momentjs.com
-
由于限制,我无法在该项目中安装任何东西......还有其他基本工作吗?
-
你查看过 .toISOString() 上的 MDN 文档吗?
-
我试过 .toISOString() :( 不走运。
标签: javascript json mongodb