数据存储:保存与检索(日期时间值)

Datastore: Saved vs Retrieved (Datetime values)

大家好!

我正在使用 NodeJS 客户端库在数据存储中保存一些日期时间和其他值。

在 GCP 中显示:

但是当我得到这些值时("fecDocumento" 和 "fecRegistro")。这个returns:

- fecDocumento: 1517806800000000
- fecRegistro: +050068-07-10T00:16:40.000Z

如果我将该值转换为日期变量。打印的值是:

- fecDocumento: Fri May 20 50067 03:00:00 GMT-0500 (Hora est. Pacífico, Sudamérica)
- fecRegistro: Mon Jul 09 50068 19:16:40 GMT-0500 (Hora est. Pacífico, Sudamérica)

任何建议都会很棒!

fecDocumento 似乎是以微秒为单位的 unix 时间戳,大多数日期时间库都希望 unix 时间戳以毫秒或秒为单位。看起来你的价值正在成倍增加

1517806800(unix 时间戳,以秒为单位)相当于:02/05/2018 @5:00am (UTC)

https://www.unixtimestamp.com/index.php