| Crates.io | strptime |
| lib.rs | strptime |
| version | 1.1.3 |
| created_at | 2024-04-03 22:00:43.183397+00 |
| updated_at | 2024-05-16 16:44:17.457488+00 |
| description | Date & time parsing without date library dependencies. |
| homepage | |
| repository | https://github.com/lukesneeringer/strptime-rs |
| max_upload_size | |
| id | 1195605 |
| size | 31,598 |
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.
Not all strptime/strftime specifiers are supported yet. The Parser struct documents the
list.
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);