将数值转换为日期时间
我有以下数值。我需要将其转换为日期时间格式。
1627074000000
要查看更多这样的值(例如 1627077600000),您可以参考以下链接 -
https://coindatadesktop.com/coins/getRelatives.php?symbol=VNDC&limit=48&modo=pre
我用谷歌搜索了一下,发现(这里)它是 GMT 格式。
<startTimeGmtMs>1627243200000</startTimeGmtMs>
<endTimeGmtMs>1627248600000</endTimeGmtMs>
我试过这个,但返回无效的日期 -
as.POSIXct(1627243200000, origin = "1970-01-01", tz = "GMT")
回答
这似乎在miliseconds:
尝试:
as.POSIXct(1627243200000/1000, origin = "1970-01-01", tz = "GMT")
[1] "2021-07-25 20:00:00 GMT"
- 击败我 28 秒,点赞。