我有一个字符串格式的日期,我试图进入 MongoDB 作为 DateTime
类型 . 日期字符串已在 UTC 中,格式为 2017-11-30 19:41:00:677
.
插入MongoDB时,我插入数据:
{
"timestamp": new Date("2017-11-30 19:41:00:677"),
...
}
但是,当我这样做时,日期被认为是当地时间(似乎),并且Mongo通过添加4小时将其转换为UTC . 然而 19:41 已经在UTC了 .
How can I tell Mongo that the timezone is already in UTC?
1 回答
https://docs.mongodb.com/v3.2/tutorial/model-time-data/