home ~ projects ~ socials

RSS Uses The RFC 822 Datetime Format

Wibbly-Wobbly

According to the RSS Spec1, datetimes should be formatted via RFC 822 which was published in 1982.

But, RFC 822 was obsoleted by RFC 2822 which was published in 2001.

But, RFC 2822 was obsoleted by RFC 5322 which was published in 2008.

But, RFC 5322 was updated by RFC 6854 which was published in 2013.

Working with times is no joke.

Pick One

Anyway, I'm using Rust's chrono2 library which outputs RFC 2822 and calling it a day.

---
[dependencies]
chrono = "0.4.40"
chrono-tz = "0.10.3"
---

use chrono::TimeZone;
use chrono_tz::Tz;

fn main() {
  let tz: Tz = "America/New_York".parse().unwrap();
  let dt_daylight_time = tz.with_ymd_and_hms(
    2025, 4, 23, 23, 6, 54
  ).unwrap();
  println!("{}", dt_daylight_time.to_rfc2822());
}
Output:
Wed, 23 Apr 2025 23:06:54 -0400
-- end of line --

Footnotes