Skip to main content

civil_from_days

Function civil_from_days 

Source
pub fn civil_from_days(z: i64) -> (i32, u32, u32)
Expand description

Proleptic Gregorian (year, month, day) for a day count z since 1970-01-01 (the inverse of days_from_civil).

The calendar repeats every 400 years (146_097 days): chrono converts the day within its cycle and whole cycles go back into the year (an i128 so no z overflows), which matches the proleptic Gregorian answer the old hand-rolled code gave past NaiveDate’s ±262143 range. 1970-01-01 is num_days_from_ce 719_163.