Skip to main content

parse_date_literal_ordered

Function parse_date_literal_ordered 

Source
pub fn parse_date_literal_ordered(s: &str, order: DateOrder) -> Option<i32>
Expand description

v7.39 (GUC knife 5) — DateOrder-aware date input. PG disambiguates a three-field numeric date (01/02/2024, 02.01.2024, 1/2/24) by the DateStyle field order: MDY reads month first (the default — so '01/02/2024' is Jan 2 even with no SET), DMY day first, YMD year first ('24/01/02', and '1/2/24' is 2001-02-24!). A two-digit year is < 70 → 20xx, >= 70 → 19xx. Field values that don’t fit the order error (MDY '13/02/2024' is out of range — PG does NOT auto-swap). ISO year-first four-digit forms parse the same under every order.