1# Date and time utils for HTTP. 2 3[](https://github.com/pyfisch/httpdate/actions/workflows/ci.yml) 4[](https://crates.io/crates/httpdate) 5[](https://docs.rs/httpdate) 6 7Multiple HTTP header fields store timestamps. 8For example a response created on May 15, 2015 may contain the header 9`Date: Fri, 15 May 2015 15:34:21 GMT`. Since the timestamp does not 10contain any timezone or leap second information it is equvivalent to 11writing 1431696861 Unix time. Rust’s `SystemTime` is used to store 12these timestamps. 13 14This crate provides two public functions: 15 16* `parse_http_date` to parse a HTTP datetime string to a system time 17* `fmt_http_date` to format a system time to a IMF-fixdate 18 19In addition it exposes the `HttpDate` type that can be used to parse 20and format timestamps. Convert a sytem time to `HttpDate` and vice versa. 21The `HttpDate` (8 bytes) is smaller than `SystemTime` (16 bytes) and 22using the display impl avoids a temporary allocation. 23 24Read the [blog post](https://pyfisch.org/blog/http-datetime-handling/) to learn 25more. 26 27Fuzz it by installing *cargo-fuzz* and running `cargo fuzz run fuzz_target_1`. 28