Ubuntu – Change “date” Command To 12 Hour Time Instead Of 24

command linedate

When I type date in gnome-terminal, or xterm it reads out in 24 hour time, is there any way to make it use 12 hour. According to date --help using %r should do the trick, but there are no examples given as to how to input that command. I've tried date %r, and date%r but they don't work. It should be noted that my GUI clock on the top panel of my screen is using 12 hour format at the moment.

Best Answer

Reading the man page,

SYNOPSIS

   date [OPTION]... [+FORMAT]

you have to put the format after a + sign.

date +%r 

should do the trick.

Related Question