Skip to main content

date_from_days

Function date_from_days 

Source
pub unsafe fn date_from_days(days: i32) -> Date
Expand description

Decomposes a DATE (days since 1970-01-01) into a calendar date.

Check is_finite_date first: DuckDB reserves extreme values for infinity / -infinity, which have no calendar representation. duckdb_from_date does not check for them โ€” it cannot fail โ€” so a sentinel decomposes into a date that looks real: infinity becomes 5881580-07-11, one day past the largest date DuckDB accepts.

ยงSafety

The DuckDB C API dispatch table must be initialised โ€” it always is inside a callback or a registration closure.