0

I have a problem with timezone in debian

I need to set up zone with 12h format (AM/PM) throughout the system. Locale set to "en_US.UTF.8", output "date" command is correctly. Time format in "timedatectl" is incorrect (24h). Any ideas?

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

timedatectl

    Local time: Mon 2022-02-21 20:09:15 CET
           Universal time: Mon 2022-02-21 19:09:15 UTC
                 RTC time: Mon 2022-02-21 19:09:14
                Time zone: Europe/Warsaw (CET, +0100)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no

date

Mon 21 Feb 2022 08:09:08 PM CET

systemctl process status

   Active: active (running) since Mon 2022-02-21 20:09:01 CET; 22s ago


    
xXx
  • 1
  • 1

2 Answers2

1

12 hour AM/PM or 24 hour format is a matter of locale preference - not the time zone.

Zac67
  • 8,639
  • 2
  • 10
  • 28
  • Ok, how can i get 12H (AM/PM) in systemctl process status? In my process i have a errors with bad parsing time. I think changing the time display to AM / PM will solve the problem – xXx Feb 21 '22 at 23:33
1

timedatectl will not print 12-hour time, calls strftime() with %a %Y-%m-%d %H:%M:%S

GNU coreutils date calls localized functions which in some cases can call strftime() with hour minute second of %I:%M:%S %I is 12-hour hours. Also date can be called with a custom format, for example date +%r

John Mahowald
  • 30,009
  • 1
  • 17
  • 32