Reputation: 95
I am trying to convert epoch time to date. I have a numeric array with epoch times.
I tried this -
print(as.POSIXct(x), origin = "1970-01-01", tz = "CST6CDT"))
Where x
represents the numeric array with epoch times
#Output:
" CDT" " CST" " CDT" " CDT" " CDT" " CST" " CDT" " CST"
I have tried these-
print(as.POSIXct(1403878908842, origin = "1970-01-01", tz = "CST6CDT"))
print(as.POSIXct(1403878908842, origin = "1970-01-01", tz = ""))
But they all return timezones not the converted date.
Upvotes: 1
Views: 908
Reputation: 269644
Try this:
as.POSIXct(1403878908842/1000, origin = "1970-01-01", tz = "")
## [1] "2014-06-27 10:21:48 EDT"
as.POSIXct(1403878908842/1000, origin = "1970-01-01", tz = "CST6CDT")
## [1] "2014-06-27 09:21:48 CDT"
Upvotes: 2