0

I have the below numeric value. I need to convert it into datetime format.

1627074000000

To see more values like this (for e.g. 1627077600000), you can refer the link below - https://coindatadesktop.com/coins/getRelatives.php?symbol=VNDC&limit=48&modo=pre

I googled a bit and found (here) it's in GMT format.

<startTimeGmtMs>1627243200000</startTimeGmtMs>
<endTimeGmtMs>1627248600000</endTimeGmtMs>

I tried this but returns invalid date -

as.POSIXct(1627243200000, origin = "1970-01-01", tz = "GMT")
Ujjawal Bhandari
  • 1,333
  • 1
  • 8
  • 16

1 Answers1

5

This seems to be in miliseconds:

try:

as.POSIXct(1627243200000/1000, origin = "1970-01-01", tz = "GMT")
[1] "2021-07-25 20:00:00 GMT"
Onyambu
  • 67,392
  • 3
  • 24
  • 53
  • 3
    Beat me by 28s, upvote. – Rui Barradas Jul 25 '21 at 18:43
  • Duplicate though, answered same/similar question years ago (at least once). Booh: wasn't an accepted answer hence not eligible: https://stackoverflow.com/a/40921425/143305. Found another eligible one (and of course upvoted this answer which is still correct, if only redundant given the dupes). – Dirk Eddelbuettel Jul 25 '21 at 19:42