Crates.io | anydate |
lib.rs | anydate |
version | 0.4.0 |
source | src |
created_at | 2021-11-10 04:02:19.17605 |
updated_at | 2023-12-29 21:59:05.643217 |
description | Date & DateTime string parser |
homepage | |
repository | https://github.com/rust-playground/anydate |
max_upload_size | |
id | 479449 |
size | 70,541 |
This crate is used to parse an unknown DateTime or Date format into a normalized version.
Any significant changes to anydate are documented in
the CHANGELOG.md
file.
[dependencies]
anydate = "0.4"
Optional features:
serde
: Enable deserialize_with helper functions via serde.fn main() -> Result<(), Box<dyn std::error::Error>> {
// see parse_utc() for convenience conversion to UTC
let parsed = anydate::parse("2021-11-10T03:25:06.533447000Z");
println!("{:#?}", parsed);
Ok(())
}
or if you know it's only a date with no time component
fn main() -> Result<(), Box<dyn std::error::Error>> {
let parsed = anydate::date::parse("2021-11-10");
println!("{:#?}", parsed);
Ok(())
}