Ubuntu – Date command output format

datetimezone

I have just installed ubuntu server 19.10. When I enter the date command I get the following output

Sun 10 Nov 2019 05:16:05 PM AEDT

My old server running 18.04 gives this output

Sun Nov 10 17:16:16 AEDT 2019

Note the difference in both the time given and the format.

Can someone advise me where the default format for date output is configured. I can't see anything in the environment variables.

Note that timedatectl for both give similar results, the only difference being that 18.04 is using systemd-timesyncd and 19.10 is using NTP.

18.04

Local time: Sun 2019-11-10 17:16:18 AEDT
Universal time: Sun 2019-11-10 06:16:18 UTC
RTC time: Sun 2019-11-10 06:16:18
Time zone: Australia/Melbourne (AEDT, +1100)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no

19.10

Local time: Sun 2019-11-10 17:16:12 AEDT
Universal time: Sun 2019-11-10 06:16:12 UTC
RTC time: Sun 2019-11-10 06:16:12
Time zone: Australia/Melbourne (AEDT, +1100)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no

Best Answer

The difference in format appears to be (not tested) caused by /usr/share/i18n/locales/en_US having date_fmt set in version 19.10 but not in 18.04. To fix (avoid) the problem, I changed my locale to en_AU.UTF-8. sudo vi /etc/locale.gen and uncommented en_AU.UTF-8. sudo locale-gen sudo update-locale LANG=en_AU.UTF-8 exit I did this on both servers and they now report the date in the same format.