Skip to main content

Module datetime

Module datetime 

Source
Expand description

Canonical date/datetime parsing and formatting helpers. Canonical Date/Datetime handling backed by Chrono’s ISO-8601 calendar implementation. RushDB stores instants as UTC epoch milliseconds.

Functions§

component_of
Extract one calendar component from epoch milliseconds, using Chrono’s field order: 0 year, 1 month, 2 day, 3 hour, 4 minute, 5 second, 6 millisecond, 7 microsecond, 8 nanosecond.
components_to_epoch_ms
Build epoch milliseconds from validated calendar components.
components_to_epoch_ms_checked
Convert calendar components to epoch milliseconds, rejecting values that fall outside the representable range.
is_datetime_string
Report whether a string parses as any supported datetime form.
json_datetime_ms
Extract epoch milliseconds from a JSON number or datetime string.
ms_to_datetime_string
Serialize epoch milliseconds as a date at midnight UTC, otherwise as an RFC-3339 UTC timestamp with millisecond precision.
parse_datetime
Parse a date-only value, RFC 3339 timestamp, or timezone-less ISO local datetime (defined by RushDB as UTC) into epoch milliseconds.
start_of_month
Epoch milliseconds for the first instant of the calendar month containing ms.
start_of_quarter
Start of the 3-month calendar quarter containing ms (quarters start at months 1, 4, 7, 10).
start_of_year
Epoch milliseconds for the first instant of the calendar year containing ms.