Module dateparser::datetime [−][src]
Expand description
Datetime string parser
use chrono::prelude::*; use dateparser::datetime::Parse; use std::error::Error; fn main() -> Result<(), Box<dyn Error>> { let parse_with_local = Parse::new(&Local); assert_eq!( parse_with_local.parse("2021-06-05 06:19 PM")?, Local.ymd(2021, 6, 5).and_hms(18, 19, 0).with_timezone(&Utc), ); let parse_with_utc = Parse::new(&Utc); assert_eq!( parse_with_utc.parse("2021-06-05 06:19 PM")?, Utc.ymd(2021, 6, 5).and_hms(18, 19, 0), ); Ok(()) }
Structs
Parse | Parse struct has methods implemented parsers for accepted formats. |