How to change the output of `date` back to 24-hour format

dateglibclocaleupgrade

Apparently a recent change (in Glibc 2.29?) causes the date command to start printing times in 12-hour format:

$ date
Fri 23 Aug 2019 07:34:13 PM PDT

This is for my default locale

$ cat /etc/locale.conf 
LANG=en_US.UTF-8

How can I configure my system to go back to displaying dates in 24-hour format?

Best Answer

As suggested by jamespharvey20 on IRC, I just changed LC_TIME to another locale. I set it in /etc/locale.conf:

$ cat /etc/locale.conf
LANG=en_US.UTF-8
LC_TIME=en_GB

I also exported this value of LC_TIME in my shell profile, to avoid having to restart (I couldn't figure out how to get Systemd to reread the locale.conf). This seems a bit hacky but I think it's the best we came up with. Also, it preserves the new "DD MMM" format which I prefer to the old "MMM DD".

Related Question