【发布时间】:2013-12-20 02:05:10
【问题描述】:
我正在使用以以下格式返回时间值的 API:
2013:02:27T06:39:25
请注意缺少任何时区标识符。
来自 API 文档:
https://partner-api.groupon.com/ledger
"Transaction timestamp of the ledger entry in the affiliate's time-zone.. The format is YYYY-MM-DDThh:mm:ss.. Example 2013:02:27T06:39:25"
API 响应时区显然是 EST(附属公司的时区)。从中获取 UTC 时区值以存储在 MongoDB 数据库中的最佳方法是什么。
【问题讨论】:
-
检查这个答案How do you create a JavaScript Date object with a set timezone without using a string representation。有
parseISO8601String()函数的例子。
标签: javascript node.js api mongodb date