Fun with Dates and Emacs

a note to myself about creating RSS and Atom friendly dates for posts in Emacs


Looks like my RSS feeds aren’t validating (or working in Friendica) because the dates aren’t RFC-822 compliant. Well, shit. I thought I had that right.

In Emacs I’d inject a RFC-822 date into my file with the following command:

C-u M-! date -u --rfc-822 -d "2023-05-13 23:58".

That’ll give the following date string: “Sat, 13 May 2023 23:58:00 +0000”.

If I want the same date for Atom feeds in Emacs, the following should do nicely:

C-u M-! date -u -Iseconds -d "2023-05-13 23:58".

It yields “2023-05-13T23:58:00+00:00”.

The -u option gives a date with a UTC timestamp, because back-dating posts and keeping EST vs EDT straight is driving me to drink.

Time to spam our Congresscritters. Demand the abolition of daylight savings time for great justice!

For people on macOS and BSD, the commands above use GNU date, which comes with GNU coreutils. If you have coreutils installed, you’ll want to use gdate instead of date.