Aliens wildland

2022 02Feb 06

Filed under Technical

Date formats

Some date formats are better than others. For RSS on the blog, I'm forced to use the atrocious RFC 2822:

date --rfc-2822 -u
Sun, 06 Feb 2022 17:34:20 +0000

The day of the week won't sort lexicographically. Then it's dd-mm-yyyy format, objectively backwards, and the month is not even a number!

Compare with the superior RFC 3339:

date --rfc-3339=seconds -u
2022-02-06 17:36:14+00:00

Years, months, days, it's perfect. Why sort all the Sundays from 2022 and all the Sundays from 2010 together, when you could keep all of 2022 together? With RFC 3339, you don't even have to write disgusting date-reckoning code to sort it properly. (Assuming there are no leap seconds. IERS, you can do the right thing, please abolish leap seconds.)

But I concede that it's not human-readable.

As a compromise, I propose these formats, which are both human-readable and lexicographically sortable:

2022-02Feb-06 I use this one on the blog's index already.

2022-02Feb-06Sun If you really want the day of the week.

Dear reader, have some faith in yourself. You are smarter than the people who invented email and PHP!

aliens_wildland favicon