Expand description
The proleptic Gregorian calendar and HTTP-date (RFC 9110 section 5.6.7).
§Examples
use parse_net as pn;
let d = pn::HttpDate::parse_imf_fixdate(b"Sun, 06 Nov 1994 08:49:37 GMT")?;
assert_eq!(d.unix(), 784_111_777);
assert_eq!(&d.format(), b"Sun, 06 Nov 1994 08:49:37 GMT");
let now = 1_792_540_800; // 2026-10-21
assert_eq!(pn::http_date_at(b"Sun Nov 6 08:49:37 1994", now)?, d);
assert_eq!(pn::http_date_at(b"Wednesday, 01-Jan-76 00:00:00 GMT", now)?.civil().year, 2076);
assert_eq!(pn::http_date_at(b"Saturday, 01-Jan-77 00:00:00 GMT", now)?.civil().year, 1977);Structs§
- Civil
- A broken-down UTC time.
- Http
Date - A point in time with one-second resolution, from year 1 to year 9999,
UTC; the value of HTTP-date fields (
Date,Last-Modified,Expires).
Enums§
- Date
Format - The HTTP-date format a value was written in.
Functions§
- civil_
from_ days - The civil date
(year, month, day)for a day count since 1970-01-01, after Howard Hinnant’scivil_from_days. - days_
from_ civil - Days since 1970-01-01 for a civil date, after Howard Hinnant’s
days_from_civil. - days_
in_ month - The number of days in
month(1 to 12) ofyear; 0 for any other month. - http_
date std - Parses an HTTP-date in any format, resolving RFC 850 years against the system clock.
- http_
date_ at - Parses an HTTP-date in any format, resolving RFC 850 years against
now. - is_
leap_ year - Whether
yearis a leap year in the proleptic Gregorian calendar. - weekday_
from_ days - The ISO 8601 weekday (1 = Monday … 7 = Sunday) of a day count since 1970-01-01.