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

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_new2 <- as.Date(extime_new1)                       # Converting POSIXct to Date
extime_new2
# "2005-04-01"

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top