Unix Timestamp in R
Look up the current epoch time and convert between Unix seconds and UTC dates in R.
Get the current timestamp
cat(sprintf("%.0f\n", floor(as.numeric(Sys.time()))))Timestamp to date
cat(format(as.POSIXct(1700000000, origin = "1970-01-01", tz = "UTC"),
"%Y-%m-%dT%H:%M:%SZ", tz = "UTC"), "\n")Date to timestamp
date <- as.POSIXct("2023-11-14 22:13:20", tz = "UTC")
cat(sprintf("%.0f\n", floor(as.numeric(date))))Open 1700000000 in the converter
Current Unix time
Seconds—
Milliseconds—
- UTC
- —
- My time zone
- —
Free to use. Your input stays in this browser.
How to use it
- Copy the current-time example into your R environment to read Unix seconds.
- Run the second example to display 1700000000 as a UTC date.
- Run the last example to convert that date back into seconds.
POSIXct represents seconds as a numeric value. Supply origin when converting numeric values, and specify tz = "UTC" to keep the result independent of your session.