Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

You have to add a "+" before the option like This,

date +%r
share|improve this answer

Reading the man page,


   date [OPTION]... [+FORMAT]

you have to put the format after a + sign.

date +%r 

should do the trick.

share|improve this answer

You can make an alias for date in .bashrc by typing alias date=date +%r and then doing source .bashrc, if you want to change date default format.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.