If you use the
date command on the command line, and get back something like
Fri 22 Nov 2019 02:47:51 PM EST, then it means your locale settings are currently set to a locale that specifies a 12-hour time format.
locale to view the current locale settings. Basically, all the locale settings are just environment variables, but there are some dependencies between them.
The logic of the locale settings is as follows:
LANG variable will define the default locale for all the
LC_* locale categories, unless there is a more specific setting for a particular category.
Each locale category has a name, like
LC_CTYPE for the character set being used,
LC_COLLATE for sorting order, and
LC_TIME for the representation of date and time. If an environment variable corresponding to the name of the locale category exists, it will override the default set by
Finally, there is an ultimate override
LC_ALL. If it is set, it will override all the other locale settings. It is typically used in scripts or similar as
export LC_ALL=C, to ensure that the output of any commands used by the script will be in the POSIX default US English format instead of any localized format that might make parsing the output more difficult. (Of course, parsing the output intended for humans in a script is a non-ideal choice in the first place - if a command has a "script-friendly output" option, you should use it instead!)
Historically, on RedHat/Fedora, the system default locale settings should be in
/etc/sysconfig/i18n file (i18n = internationali[s|z]ation, 18 characters between i and n). On modern versions, ther should be a
localectl command you can use to query and modify the locale and keyboard layout settings persistently. Note that environment variable settings can always be used to override system-wide locale defaults!
If you are using the default
en_US.UTF-8 locale, then
en_GB.UTF-8 would be the closest equivalent with 24-hour time representation. To set it, use:
localectl set-locale LC_TIME=en_GB.UTF-8
Then logout & log back in to have the change take effect in your session.
If you use some other locale, use
localectl list-locales to see the available locale definitions.
If you are unsure, you can test the output by specifying the desired locale as an environment variable for the
$ LC_TIME=en_GB.UTF-8 date
Sat 23 Nov 15:47:16 EET 2019
$ LC_TIME=en_US.UTF-8 date
Sat 23 Nov 2019 03:47:19 PM EET