Convert Unix timestamp into datetime

谁说胖子不能爱 提交于 2019-12-03 00:08:00
Emer

You have to convert from Factor to Character To Number before using as.POSIXct. The function is expecting an integer as a Unixtime

head(as.POSIXct(as.numeric(as.character(try$time)),origin="1970-01-01",tz="GMT"))
Kushal Shah

It's because the epoch is not numeric, try converting it into a number and it works like wonder!

try$time <- as.POSIXct(as.numeric(try$time), origin = '1970-01-01', tz = 'GMT')

Try

head(as.POSIXct(as.integer(as.numeric(as.character(try$time)) / 1000.0), 
origin='1970-01-01', tz="GMT"))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!