Skip to main content

Module date

Module date 

Source
Expand description

HTTP dates: Date, Last-Modified, If-Modified-Since, Expires.

RFC 9110 §5.6.7 has one format for sending — IMF-fixdate, Sun, 06 Nov 1994 08:49:37 GMT — and two obsolete ones a recipient must still accept: RFC 850’s Sunday, 06-Nov-94 08:49:37 GMT and C’s asctime, Sun Nov 6 08:49:37 1994. Nothing has sent the old two in decades, but a validator that rejects them makes a conditional request unconditional, and the client pays for a body it already had.

Functions§

http_date
Format a unix timestamp as an HTTP date (RFC 7231 IMF-fixdate).
parse_http_date
Parse any of the three HTTP date formats to a unix timestamp.
parse_ymd
YYYY-MM-DD at midnight UTC, as a unix timestamp.