Skip to main content

Module datetime

Module datetime 

Source
Expand description

Date and time builtins: Sys.Date, as.Date, as.POSIXct, format.Date, etc.

Uses the jiff crate for timezone-aware date/time operations. R stores dates as doubles with class attributes:

  • Date: days since 1970-01-01
  • POSIXct: seconds since epoch, class = c(“POSIXct”, “POSIXt”)

Enums§

DateTimeError

Constants§

EPOCH 🔒
The Unix epoch as a jiff Date.

Statics§

__BUILTIN_REG_BUILTIN_AS_DATE 🔒
__BUILTIN_REG_BUILTIN_AS_POSIXCT 🔒
__BUILTIN_REG_BUILTIN_AS_POSIXLT 🔒
__BUILTIN_REG_BUILTIN_DATE 🔒
__BUILTIN_REG_BUILTIN_DIFFTIME 🔒
__BUILTIN_REG_BUILTIN_FORMAT_DATE 🔒
__BUILTIN_REG_BUILTIN_FORMAT_POSIXCT 🔒
__BUILTIN_REG_BUILTIN_MONTHS 🔒
__BUILTIN_REG_BUILTIN_QUARTERS 🔒
__BUILTIN_REG_BUILTIN_STRFTIME 🔒
__BUILTIN_REG_BUILTIN_STRPTIME 🔒
__BUILTIN_REG_BUILTIN_SYS_DATE 🔒
__BUILTIN_REG_BUILTIN_SYS_TIME 🔒
__BUILTIN_REG_BUILTIN_WEEKDAYS 🔒
__INTERP_REG_INTERP_PRINT_DATE 🔒
__INTERP_REG_INTERP_PRINT_DIFFTIME 🔒
__INTERP_REG_INTERP_PRINT_POSIXCT 🔒

Functions§

builtin_as_date 🔒
Convert a character string or numeric value to a Date object.
builtin_as_posixct 🔒
Convert a character string or numeric value to a POSIXct date-time.
builtin_as_posixlt 🔒
Convert a value to a POSIXlt (broken-down time) list representation.
builtin_date 🔒
Return the current date and time as a character string.
builtin_difftime 🔒
Compute the time difference between two date-time values.
builtin_format_date 🔒
Format a Date object as a character string.
builtin_format_posixct 🔒
Format a POSIXct object as a character string.
builtin_months 🔒
Extract the month name from a Date object.
builtin_quarters 🔒
Extract the quarter from a Date object.
builtin_strftime 🔒
Format a POSIXct date-time as a character string.
builtin_strptime 🔒
Parse a character string into a POSIXct date-time using a format specification.
builtin_sys_date 🔒
Get the current date.
builtin_sys_time 🔒
Get the current date-time as a POSIXct value.
builtin_weekdays 🔒
Extract the day-of-week name from a Date object.
civil_to_zoned 🔒
Convert a civil DateTime to a Zoned datetime in the given timezone.
date_to_days 🔒
Convert a jiff Date to days-since-epoch (f64).
days_to_date 🔒
Convert days-since-epoch (f64) to a jiff Date.
extract_date_component 🔒
Helper: extract a string component from each date in a Date vector.
interp_print_date 🔒
Print a Date object to stdout.
interp_print_difftime 🔒
Print a difftime object to stdout.
interp_print_posixct 🔒
Print a POSIXct object to stdout.
parse_date_string 🔒
Try common date formats in order.
parse_datetime_string 🔒
Try common datetime formats.
r_date 🔒
Build an RValue with class = “Date”.
r_date_vec 🔒
Build a Date vector with class attr from days values.
r_posixct 🔒
Build an RValue with class = c(“POSIXct”, “POSIXt”).
r_posixct_vec 🔒
Build a POSIXct vector from multiple seconds values.
resolve_origin 🔒
Resolve the ‘origin’ argument for numeric→Date conversion.
secs_to_timestamp 🔒
Convert seconds-since-epoch (f64) to a jiff Timestamp.
timestamp_to_secs 🔒
Extract seconds-since-epoch from a Timestamp.
translate_format 🔒
Map R strftime codes to jiff strftime codes. Most are identical; R’s %OS (fractional seconds) maps to %S%.f.