| Action |
Code |
Details |
|
From ymd
|
ISOdate(year, month, day)
|
|
|
From ymd
|
lubridate::make_date(year, month, day) |> as.POSIXct()
|
|
|
From ymdhms
|
ISOdatetime(year, month, day, hour, minute, second)
|
|
|
From ymdhms
|
lubridate::make_datetime(year, month, day, hour, min, sec)
|
|
|
From ymdhms in UTC timezone
|
ISOdatetime(years, months, days, hours, minutes, seconds, tz = 'UTC')
|
|
|
Current date in UTC
|
Sys.Date() |> as.POSIXct()
|
|
|
Current datetime
|
|
|
|
Current datetime
|
|
|
|
Current datetime in UTC timezone
|
lubridate::now(tzone = 'UTC')
|
|
|
Unix epoch
|
|
|
|
From total seconds since Unix epoch
|
|
|
|
From total seconds since reference date
|
as.POSIXct(n, origin = ref_date)
|
|
|
Datetime from YYYY-MM-DD string
|
|
|
|
Datetime from YYYY-MM-DD HH:mm:ss string
|
|
|
|
Date from DD-MM-YYYY string
|
as.POSIXct(x, format = '%d-%m-%Y')
|
|
| Action |
Code |
Details |
|
Shift forward by n days
|
|
|
|
Shift forward by n days
|
|
|
|
Shift forward by n seconds
|
|
|
|
Shift forward by a specific ymdhms period
|
x + lubridate::period(year, month, day, hour, minute, second)
|
|
|
Truncate to date
|
trunc(x, 'days') |> as.POSIXct()
|
Drops the time component, falling back to midnight 00:00:00 |
|
Truncate to hours
|
trunc(x, 'hours') |> as.POSIXct()
|
|
|
Truncate to minutes
|
trunc(x, 'mins') |> as.POSIXct()
|
|