Skip to main content

parse_date

Function parse_date 

Source
pub fn parse_date(text: &str) -> Option<PgDate>
Expand description

Parse a YYYY-MM-DD date with a year of four or more digits and PostgreSQL’s trailing BC, or infinity and -infinity. Year 0000, as MySQL and SQLite print 1 BC, is year 0.

let d = sql_values::postgres::parse_date("2024-01-02").unwrap();
assert_eq!(d.to_string(), "2024-01-02");