Extract date and time from unix timestamp in R




I have timestamp in my data in the UNIX format from which I want to extract date and time as they would be of more use to me than the timestamp.
(let an example for a timestamp be 1372657859)
How can I perform this task in R?



That should answer your question.

> value <- 1372657859
> as.Date(as.POSIXct(value, origin="1970-01-01"))
[1] "2013-07-01"

> as.POSIXct(value, origin="1970-01-01")
[1] "2013-07-01 11:20:59 IST"

then use lubridate package


It resolved the issue I was facing while dealing with timestamp


convert 1509256348059000 it wont happen


In a blank cell next to your timestamp list and type this formula =(((A1/60)/60)/24)+DATE(1970,1,1), press Enter key, then drag the auto fill handle to a range you need.