Module datetime

Source
Expand description

Common data and time functions.

Constants§

MILLISECONDS_IN_SECOND
Number of milliseconds in one second.
NANOSECONDS_IN_MICROSECOND
Number of nanoseconds in one microsecond.
NANOSECONDS_IN_MILLISECOND
Number of nanoseconds in one millisecond.
NANOSECONDS_IN_SECOND
Number of nanoseconds in one second.
WEEKDAYS
List of weekdays (Monday to Friday).

Functions§

add_n_months
Add n months to a chrono DateTime<Utc>.
floor_to_nearest_microsecond
Floor the given UNIX nanoseconds to the nearest microsecond.
is_leap_year
Basic leap-year check
is_within_last_24_hours
Check whether the given UNIX nanoseconds timestamp is within the last 24 hours.
last_day_of_month
Returns the last valid day of (year, month).
last_weekday_nanos
Calculates the last weekday (Mon-Fri) from the given year, month and day.
micros_to_nanos
Converts microseconds (μs) to nanoseconds (ns).
millis_to_nanos
Converts milliseconds (ms) to nanoseconds (ns).
nanos_to_micros
Converts nanoseconds (ns) to microseconds (μs).
nanos_to_millis
Converts nanoseconds (ns) to milliseconds (ms).
nanos_to_secs
Converts nanoseconds (ns) to seconds.
secs_to_millis
Converts seconds to milliseconds (ms).
secs_to_nanos
Converts seconds to nanoseconds (ns).
subtract_n_months
Subtract n months from a chrono DateTime<Utc>.
unix_nanos_to_iso8601
Converts a UNIX nanoseconds timestamp to an ISO 8601 (RFC 3339) format string.
unix_nanos_to_iso8601_millis
Converts a UNIX nanoseconds timestamp to an ISO 8601 (RFC 3339) format string with millisecond precision.