6

Since updating to Debian Buster, running date on the terminal shows the clock in AM/PM format instead of 24hr clock. This is new and is happening on all updated installations.

Docker container:

yeri@b9b3e889fd76 ~ $ date
Thu 01 Aug 2019 11:28:25 PM +08

Native host:

liana ~ # date
Thu 01 Aug 2019 11:32:44 PM +08

Digital Ocean:

ui0 ~ # date
Thu 01 Aug 2019 05:33:11 PM CEST

This is quite annoying and I didn't ask for this -- however can't find the settings to change it.

The only thing I can think of is that the locale is set to US; but that was the case before as well (Debian 9):

ui0 ~ # cat /etc/default/locale 
#  File generated by update-locale
LANG=en_US.UTF-8
yeri@b9b3e889fd76 ~ $ locale
LANG=en_US.UTF-8
LANGUAGE=
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

yeri@b9b3e889fd76 ~ $ date
Sun 04 Aug 2019 04:39:14 PM +08

yeri@b9b3e889fd76 ~ $ locale date_fmt
%a %d %b %Y %r %Z

yeri@b9b3e889fd76 ~ $ locale -k LC_TIME
abday="Sun;Mon;Tue;Wed;Thu;Fri;Sat"
day="Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"
abmon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"
mon="January;February;March;April;May;June;July;August;September;October;November;December"
am_pm="AM;PM"
d_t_fmt="%a %d %b %Y %r %Z"
d_fmt="%m/%d/%Y"
t_fmt="%r"
t_fmt_ampm="%I:%M:%S %p"
era=
era_year=""
era_d_fmt=""
alt_digits=
era_d_t_fmt=""
era_t_fmt=""
time-era-num-entries=0
time-era-entries="S"
week-ndays=7
week-1stday=19971130
week-1stweek=1
first_weekday=1
first_workday=2
cal_direction=1
timezone=""
date_fmt="%a %d %b %Y %r %Z"
time-codeset="UTF-8"
alt_mon="January;February;March;April;May;June;July;August;September;October;November;December"
ab_alt_mon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"
8
  • What is the locale set to on your other systems? it certainly doesn't look like US! Aug 1, 2019 at 19:14
  • It's en_US.UTF-8 everywhere
    – Tuinslak
    Aug 3, 2019 at 5:09
  • How are you sure? Again, that does not look like en_US.UTF-8. Check the output of the locale command. Aug 3, 2019 at 5:26
  • updated main post
    – Tuinslak
    Aug 4, 2019 at 8:39
  • 1
    Check locale date_fmt and locale -k LC_TIME. Try changing locale to C.UTF-8 (POSIX standards-compliant locale).
    – JosefZ
    Aug 8, 2019 at 8:39

1 Answer 1

9

It seems the reason for this change is that in buster the en_US locale is updated. Since it is meant to represent US customs, which is to specify time in the 12 hour format, time is now shown as such, even though it may come as a surprise to everyone who has relied on the old behavior.

A solution, as already mentioned by @JosefZ in the comments, is to use a locale that has the time settings that you want, for example C.UTF-8. To make this change permanent on Debian you'd run:

update-locale LC_TIME=C.UTF-8

This sets the definition for LC_TIME in the file /etc/default/locale.

You can find more information about the change itself in Debian bug #877900

5
  • 1
    Seems like if I dpkg-reconfigure to not use en_US.utf8 the date command works (but I get other warnings of missing locales). The linked command doesn't work though: isazi ~ # update-locale LC_TIME=C.UTF-8 isazi ~ # date Sun 18 Aug 2019 09:17:44 AM CEST
    – Tuinslak
    Aug 18, 2019 at 7:18
  • or.. another question; even if /etc/default/locale is empty or set to use C.UTF-8, where else can locale be set? Running that command still shows en_US for some reason.
    – Tuinslak
    Aug 18, 2019 at 7:51
  • Found the solution -- it requires a reboot to apply the new locales
    – Tuinslak
    Aug 18, 2019 at 9:08
  • 1
    A reboot should not be necessary, but you need to login again to ensure you are using the new settings. Aug 19, 2019 at 8:14
  • Yea tried exiting the shell and logging in again but for some odd reason that's not enough -- keep getting that bash error at login until I rebooted
    – Tuinslak
    Aug 20, 2019 at 11:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .