Skip to main content

Module date

Module date 

Source
Expand description

Date serial numbers.

The 1900 system counts days from 1899-12-31 (serial 1 = 1900-01-01) and, like Lotus 1-2-3 and Excel, treats 1900 as a leap year: serial 60 is the fictitious 1900-02-29. The 1904 system counts from 1904-01-01 (serial 0). Times are fractions of a day.

Structs§

DateTime
A calendar date and time of day.

Enums§

DateSystem

Constants§

MONTHS
WEEKDAYS

Functions§

civil_from_days
Proleptic Gregorian (year, month, day) for a day count z since 1970-01-01 (the inverse of days_from_civil).
datetime_from_serial
Date/time from a serial. None for negative or too-large serials.
days_from_civil
Days since 1970-01-01 for a proleptic Gregorian date, exact for every i32 year.
days_in_month
Number of days in month m of year y (1–31), or 0 for an invalid month number, for every i32 year.
days_in_month_in
Days in a month of a date system’s calendar: like days_in_month, except that February 1900 has 29 days in the 1900 system (serial 60 is the fictitious 1900-02-29).
is_leap
Whether y is a Gregorian leap year, for every i32 year.
max_serial
Last serial that is a valid date in a date system: 9999-12-31 (2958465 in the 1900 system, 2957003 in the 1904 system).
serial_from_unix_ms
Date serial (1900 system, with fraction) for a Unix time in milliseconds.
serial_from_ymd
Serial for a date. Month and day overflow roll over like DATE() (month 13 = January next year, day 0 = last day of the previous month), in the date system’s own calendar: in the 1900 system February 1900 has 29 days, so (1900, 2, 29) and (1900, 3, 0) are serial 60. None before the epoch or after 9999-12-31.
serial_in_system
Converts a 1900-system serial (as the clock supplies it) to the serial of the same instant in sys.
time_fraction
Fraction of a day for a time.
unix_now_ms
Milliseconds since the Unix epoch (UTC) from the system clock; None when the clock is unavailable. Chrono uses the browser clock on wasm32, where the standard library clock methods trap.