Skip to main content

parse_timestamp

Function parse_timestamp 

Source
pub fn parse_timestamp(text: &str) -> Option<PgTimestamp>
Expand description

Parse YYYY-MM-DD HH:MM:SS[.f] with a space or T separator, a year of four or more digits, PostgreSQL’s trailing BC, and infinity and -infinity, the fraction rounded to the microsecond. Year 0000, as MySQL and SQLite print 1 BC, is year 0.

let at = sql_values::postgres::parse_timestamp("2024-01-02 03:04:05.125").unwrap();
assert_eq!(at.to_string(), "2024-01-02 03:04:05.125");