#date #date-time #time-parser #time

chrono_parser

Parser extension on the top of chrono

1 unstable release

0.1.0 Dec 29, 2021

#433 in Date and time

Apache-2.0

8KB
123 lines

chrono parser

Date, time parser in any format. Recognize the format and parse to DateTime<FixedOffset>.

Known formats:

  • RFC1123
  • RFC1123Z
  • RFC822
  • RFC822Z
  • RFC3339_NANO
  • ANSI_C
  • UNIX_FORMAT
  • RUBY_FORMAT
  • RFC850

Usage

use chrono_parser::datetime;

fn main() {
    match datetime("02 Jan 06 15:04 -0700".to_string()) {
        Ok(v) => {...}
        Err(err) => panic!("{}", err.to_string()),
    }
}

Dependencies

~3–4.5MB
~71K SLoC