#date #time #parse

datetime_parse

parse various formats of date time strings to rfc3339

10 releases

0.0.1-beta.10 Jan 5, 2023
0.0.1-beta.9 Dec 21, 2022
0.0.1-beta.8 Oct 22, 2022
0.0.1-beta.7 Feb 20, 2022
0.0.1-beta.4 May 25, 2021

#114 in Date and time

Download history 14/week @ 2022-10-16 19/week @ 2022-10-23 15/week @ 2022-10-30 13/week @ 2022-11-06 17/week @ 2022-11-13 9/week @ 2022-11-20 8/week @ 2022-11-27 7/week @ 2022-12-04 3/week @ 2022-12-11 39/week @ 2022-12-18 4/week @ 2022-12-25 39/week @ 2023-01-01 11/week @ 2023-01-08 5/week @ 2023-01-15 9/week @ 2023-01-22

64 downloads per month

Custom license

24KB
405 lines

Date Time parser

Crates.io Travis (.org) branch GitHub

Parse various different date/time formats to a standard RFC 3339 format as chrono DateTime FixedOffset.

Note

  • If date/time does NOT have year; current year is added
  • if date/time does NOT have time-zone info; Local time-zone info is added

Some example dates are seen here!

Usage

[dependencies]
datetime_parser = "0.0.1-beta.4"

and

use datetime_parse::DateTimeFixedOffset;

fn main() {
    let date_str = "Mon, 6 Jul 1970 15:30:00 PDT";
    let result = date_str.parse::<DateTimeFixedOffset>();
    assert!(result.is_ok());
    match result {
        Ok(parsed) => println!("{} => {:?}", date_str, parsed.0),
        Err(e) => println!("Error: {}", e)
    }
}

Running the example

cargo run --example parse

Requirements

  • Rust 1.51+

Contribution

Feel free to add more formats that you see, which is not present in the library.


License: MIT

Dependencies

~1MB
~16K SLoC