strptime

Crates.iostrptime
lib.rsstrptime
version1.1.3
sourcesrc
created_at2024-04-03 22:00:43.183397
updated_at2024-05-16 16:44:17.457488
descriptionDate & time parsing without date library dependencies.
homepage
repositoryhttps://github.com/lukesneeringer/strptime-rs
max_upload_size
id1195605
size31,598
Luke Sneeringer (lukesneeringer)

documentation

https://docs.rs/strptime

README

strptime

ci codecov release docs

The strptime crate provides date and time parsing to process strings into dates. It does not depend on any existing date and time library, and can serve as a stand-alone parser.

The library can parse a date and time together, or either one separately. Dates are required to be fully-specified, while times are more permissive and will default unspecified components to zero.

Specifiers

Not all strptime/strftime specifiers are supported yet. The Parser struct documents the list.

Examples

Parsing a date and time:

use strptime::Parser;

let parser = Parser::new("%Y-%m-%dT%H:%M:%S");
let raw_date_time = parser.parse("2012-04-21T11:00:00").unwrap();
assert_eq!(raw_date_time.date().unwrap().year(), 2012);
Commit count: 12

cargo fmt