# RFC 2822

Key: `datetime.timestamp.rfc_2822`

Email header datetime format. Used in SMTP, HTTP headers, and RSS feeds. Includes abbreviated weekday and month names.

Page: <https://meridian.online/docs/projects/finetype/types/datetime/timestamp/rfc_2822>

Format: `%a, %d %b %Y %H:%M:%S %z`

Samples: `Tue, 15 Jan 2024 10:30:00 +0000`, `Sun, 31 Dec 2023 23:59:59 +0000`

## Written by

- Python `email.utils.format_datetime()`

## Background

### Origin

RFC 2822, Internet Message Format, was published in April 2001 as a Standards Track document.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt) RFC 2822 was edited by P. Resnick of QUALCOMM Incorporated.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt) RFC 2822 obsoletes RFC 822.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt) RFC 2822 was in turn obsoleted by RFC 5322, published in October 2008.[[2]](https://www.rfc-editor.org/rfc/rfc5322.txt)

RFC 822, the Standard for the Format of ARPA Internet Text Messages, is dated August 13, 1982.[[3]](https://www.rfc-editor.org/rfc/rfc822.txt) RFC 822's preface says that by 1977 the Arpanet employed several informal standards for the text messages sent among its host computers.[[3]](https://www.rfc-editor.org/rfc/rfc822.txt) RFC 822's date syntax used a two-digit year, with 20 Jun 82 as its example.[[3]](https://www.rfc-editor.org/rfc/rfc822.txt) RFC 822 took two of its time zone forms from ANSI standard X3.51-1975.[[3]](https://www.rfc-editor.org/rfc/rfc822.txt) RFC 2822 lists two-digit years and non-numeric time zones among the older forms that can no longer be generated.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt)

RFC 2822 says the form +0000 should be used to indicate a time zone at Universal Time.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt) RFC 2822 says -0000 also indicates Universal Time but means the date-time contains no information about the local time zone.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt) RFC 2822 says the date and time-of-day should express local time.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt) RFC 2822 requires the day of the week, if included, to be the day implied by the date.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt) RFC 2822 allows the time-of-day to run up to 23:59:60, to allow for a leap second.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt)

### Use

RFC 2822 says obsolete syntactic forms must not be generated but must be accepted and parsed by a conformant receiver.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt) RFC 2822's obsolete syntax lists alphabetic zones such as UT, GMT, EST and PDT.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt) RFC 2822 says UT and GMT in the obsolete zone are both semantically identical to +0000.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt) RFC 2822 says a two-digit year between 00 and 49 is interpreted by adding 2000, and one between 50 and 99 by adding 1900.[[1]](https://www.rfc-editor.org/rfc/rfc2822.txt)

RFC 9110, HTTP Semantics, defines HTTP's preferred date format, IMF-fixdate, as a fixed length, zone and capitalisation subset of the RFC 5322 format.[[4]](https://www.rfc-editor.org/rfc/rfc9110.txt) RFC 9110 requires a recipient parsing an HTTP timestamp to accept all three HTTP-date formats.[[4]](https://www.rfc-editor.org/rfc/rfc9110.txt)

The RSS 2.0 specification says all date-times in RSS conform to the Date and Time Specification of RFC 822.[[5]](https://www.rssboard.org/rss-specification) The RSS 2.0 specification makes one exception: the year may be expressed with two characters or four characters, four preferred.[[5]](https://www.rssboard.org/rss-specification)

Python's email.utils.format\_datetime writes the conventional -0000 for a naive datetime.[[6]](https://docs.python.org/3/library/email.utils.html) Python's email.utils.format\_datetime writes the numeric offset for an aware datetime.[[6]](https://docs.python.org/3/library/email.utils.html) Python's email.utils.format\_datetime can write GMT instead of a numeric offset for an aware datetime with offset zero, when usegmt is set.[[6]](https://docs.python.org/3/library/email.utils.html) Python's email.utils.parsedate\_to\_datetime returns a naive datetime when the input has a timezone of -0000.[[6]](https://docs.python.org/3/library/email.utils.html)

Before parsing a column of these, check whether every zone is numeric or whether some end in letters, and whether any years have only two digits. (Meridian's view) Treat -0000 as a time whose local zone is unknown rather than as a confirmed UTC reading, and keep that distinction if it matters downstream. (Meridian's view) A day name that disagrees with its date is worth raising with whoever produced the data, rather than silently trusting one part over the other. (Meridian's view)

### Where you'll meet it

NASA's RSS feed at www.nasa.gov/feed/ writes each item's pubDate in this form with a numeric +0000 offset.[[7]](https://www.nasa.gov/feed/)

## Sources

1. [Internet Message Format](https://www.rfc-editor.org/rfc/rfc2822.txt) — standard
2. [Internet Message Format](https://www.rfc-editor.org/rfc/rfc5322.txt) — standard
3. [STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES](https://www.rfc-editor.org/rfc/rfc822.txt) — standard
4. [HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.txt) — standard
5. [RSS 2.0 Specification (Current)](https://www.rssboard.org/rss-specification) — documentation
6. [email.utils: Miscellaneous utilities](https://docs.python.org/3/library/email.utils.html) — documentation
7. [NASA](https://www.nasa.gov/feed/) — dataset
