2

I've always seen 24h time shown in the date output. But for some reason, my Debian-based machine is now showing 12h time format:

$ date Fri 10 Jun 2022 06:16:47 PM IDT $ LC_TIME=en_IL.UTF-8 date Fri 10 Jun 2022 06:17:00 PM IDT $ LC_ALL=en_IL.UTF-8 date Fri 10 Jun 2022 18:17:05 IDT 

I don't think that I changed anything relevant lately.

$ grep LC_ ~/.bashrc export LC_TIME="en_DK.UTF-8" $ grep LC_ ~/.profile $ locale LANG=en_IL.UTF-8 LANGUAGE=en_US LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=en_US.UTF-8 

What else should I check or configure?

My goal would be to have these features:

  • 24h time format
  • YYYY-MM-DD date format
  • Week starts on Sunday
  • Text in English
  • Beer served below room temp, but not at refrigerator levels of cold
  • UTF-8 encoding

In these applications:

  • Bash commands, such as date.
  • Anki
  • Firefox
  • Thunderbird
  • KeepassXC
  • LibreOffice
  • KDE Applications, such as Okular and Dolphin
  • Gnome applications

My setup is KDE 5.18.8 on Ubuntu 20.04.4 LTS. I have no problem updating to 22.04 if necessary.

5
  • @thanasisp: file /etc/locale.conf ... No such file or directory. Should I just create that file? I would prefer that all user-specific configs (which these are) would be done in the /home/ directory. Not only because it is best practice, but also so that it will be backed up properly. Commented Jun 10, 2022 at 21:10
  • I think no, I am on different OS. I suggest you as a workaround to set LC_TIME=POSIX using the preferred Ubuntu method. Probably it is a bug after an update about locale en_US*. Commented Jun 10, 2022 at 21:14
  • 2
    Yeah, if you have a UK-type locale, the beer will be room temp. :) Commented Jun 10, 2022 at 21:37
  • @thanasisp: Setting LC_TIME in fact did not resolve the issue. I set it in bashrc and also tried setting it on the bash CLI when invoking date. Commented Jun 11, 2022 at 10:18
  • I have everything en_US.utf8 except LC_ALL= empty and LC_TIME=POSIX. Commented Jun 11, 2022 at 10:26

2 Answers 2

4

Your times are shown in 12h format because of this setting:

LC_ALL=en_US.UTF-8 

This overrides your LC_TIME setting, and produces 12h times.

Presumably something changed recently to produce this LC_ALL setting in your environment. grep -r LC_ALL /etc should tell you where.

See also What is the difference between LANG=C and LC_ALL=C? for context on LANG v. LC_ALL.

1
  • 1
    Thank you! On my work machine, with the same ~/.bashrc and ~/.profile files, in fact LC_ALL is not set. And that work machine displays date output properly. When I get home I'll grep around /etc on the affected machine. Commented Jun 13, 2022 at 8:32
0

Where this is a real bastard is not matching uptime -s. If you are scripting it always safest to use a format :

date +%H:%M:%S 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.