The Alibaba Cloud Linux 3 operating system uses the 12-hour format. Other operating systems such as Anolis OS 8 and CentOS 8 use the 24-hour format. The time format inconsistency may cause inconvenience to users. This topic describes why Alibaba Cloud Linux 3 supports the 12-hour format and how to change the 12-hour format to the 24-hour format.
Problem description
In the output of the date command that is run in the Alibaba Cloud Linux 3 operating system, the time is displayed in the 12-hour format, and the time is suffixed with AM or PM.
Cause
In Alibaba Cloud Linux 3 operating systems, the patch (Glibc.git) included in the Glibc code automatically sets the time format in the en_US language to the 12-hour format.
Solutions
You can use one of the following methods to display the time in the 24-hour format:
Solution 1: Run a query command
Query the time.
LC_TIME=C.UTF-8 dateThe time is in the 24-hour format, as shown in the following figure.

Scenario 2: Specify the 24-hour format
Open the locale.conf file.
sudo vim /etc/locale.confPress the
Ikey to enter Insert mode and add the following content to the file:LC_TIME=C.UTF-8Press the
Esckey, enter:wq, and then press theEnterkey to save and close the configuration file.Restart the system for the configuration to take effect.
sudo rebootQuery the time.
dateThe time is in the 24-hour format, as shown in the following figure.
