0

I have a vector of numeric values and need to convert these back into date and time.

dput(vector)

c(1547224631587, 1547224162579, 1547224161576, 1547224160582, 
1547224159591, 1547224158590, 1547224157574, 1547224156571, 1547224155584, 
1547224154572)

This is Unix time stamp converted into milliseconds. I have tried using POSIXlt & POSIXct but the year it comes up with is 2019. Do I need to get an idea of when the time is from?

I have tried as.Data(as.POSIXct(x/1e3,origin="1970-01-01")) but it gives out the day, month and year only which is correct but does not provide the time in hours:minutes:seconds.

Am I missing something or anyone know of a different way of getting the date as well as time using a different function?

syebill
  • 543
  • 6
  • 23
  • What's the origin and the time zone? Also, if these are milliseconds, you'll probably need divide by 1e3, because `as.POSIXct` works with seconds. Here's an example `as.POSIXct(vector/1e3, origin = "1900-01-01")` – David Arenburg Feb 02 '16 at 11:17
  • I have found out that the year is 2015 and the month is between October - December with time zone is GMT. – syebill Feb 04 '16 at 11:30

0 Answers0