9 releases (4 stable)

1.1.3 May 16, 2024
1.1.1 May 15, 2024
0.2.3 Apr 10, 2024
0.1.0 Apr 3, 2024

#524 in Date and time

Download history 675/week @ 2024-08-02 572/week @ 2024-08-09 165/week @ 2024-08-16 380/week @ 2024-08-23 248/week @ 2024-08-30 562/week @ 2024-09-06 110/week @ 2024-09-13 105/week @ 2024-09-20 102/week @ 2024-09-27 115/week @ 2024-10-04 327/week @ 2024-10-11 90/week @ 2024-10-18 16/week @ 2024-10-25 14/week @ 2024-11-01 23/week @ 2024-11-08 10/week @ 2024-11-15

69 downloads per month
Used in 3 crates

MIT license

32KB
647 lines

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);

No runtime deps