Time unit constructors for the Gregorian calendar system. These units can be
used with linear_time() to create custom time representations.
Details
The following time units are available in the Gregorian calendar (cal_gregorian$).
year(): Year unitquarter(): Quarter (3-month period) unitmonth(): Month unitday(): Day unithour(): Hour unitminute(): Minute unitsecond(): Second unitmillisecond(): Millisecond unit
These units form a hierarchy where conversions between adjacent units follow the Gregorian calendar rules. For units that don't have a fixed relationship (e.g., months to days), the conversion requires a time context.
See also
linear_time() for creating linear time points.
Examples
# Create a custom time representation using Gregorian units
linear_time(
Sys.time(),
chronon = hour(1L)
)
#> <mixtime[1]>
#> [1] 2026-Feb-24-h2