Crates.io | datetime_parse |
lib.rs | datetime_parse |
version | 0.0.1-beta.11 |
source | src |
created_at | 2021-05-24 04:44:21.495037 |
updated_at | 2023-08-17 07:20:20.39378 |
description | parse various formats of date time strings to rfc3339 |
homepage | |
repository | https://github.com/marirs/marirs/datetime-parse-rs |
max_upload_size | |
id | 401297 |
size | 34,862 |
Parse various different date/time formats to a standard RFC 3339 format as chrono DateTime FixedOffset.
Note
year
; current year
is addedtime-zone
info; Local time-zone info
is addedSome example dates are seen here!
[dependencies]
datetime_parser = "0.0.1-beta.10"
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)
}
}
cargo run --example parse
Feel free to add more formats that you see, which is not present in the library.
License: MIT