Converting UNIX Epoch Time to Date Class in R Programming (Example Code)
In this post you’ll learn how to convert UNIX epoch time objects to a date object in the R programming language.
Introduction of Example Data
extime <- 1112352325 # Example data |
extime <- 1112352325 # Example data
Example: Change Timestamp to Date
extime_new1 <- as.POSIXct(extime, origin = "1970-01-01") # Converting timestamp to POSIXct extime_new1 # "2005-04-01 12:45:25 CEST" |
extime_new1 <- as.POSIXct(extime, origin = "1970-01-01") # Converting timestamp to POSIXct extime_new1 # "2005-04-01 12:45:25 CEST"
extime_new2 <- as.Date(extime_new1) # Converting POSIXct to Date extime_new2 # "2005-04-01" |
extime_new2 <- as.Date(extime_new1) # Converting POSIXct to Date extime_new2 # "2005-04-01"