Linux change date and time system clock format to 12 hour instead of 24 hour

date
hardware

#1

Hi,

I’m trying to change the system clock to 12h instead of 24h in Centos7 as default, but I have no luck.

example:
From Thu Jan 24 19:32:16 PST 2019 to Thu Jan 24 07:32:16 PM PST 2019

I tried also to sync the hwclock, but still the format for system clock is 24h

#hwclock

Thu 24 Jan 2019 07:37:26 PM PST -0.568565 seconds

#hwclock --hctosys

Hope you can help me, thank you.


#2

You can’t change it. However, you can display as follows on the CLI:

date +"%I:%M:%S %p"

OR

date +"%c"

Sample outputs:
Friday 25 January 2019 06:50:16 PM IST
Read date command FORMAT codes such %c, %r and others from man page

man date

For GUI, go to control panel and set TIME format to 12 hour: