Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

I am trying to display only the current time using "date", not all that information Day, Month, Year etc.. , only the current time.


13:45 or 1:45pm

Any ideas?

share|improve this question
This site works best when there's one question per post, please ask your question about time since reboot as a new one, thanks! – Jorge Castro Aug 21 '13 at 22:07
up vote 7 down vote accepted
date +%R

will show you the 24 hour time, and

date +%r

will show you the time in 12 hour format. date +%H:%I also works.

Check out the "Conversion Specifications" in the manpage for more variables to pick and choose.

share|improve this answer
Do I still have to repost the other question or an OP will repost it for me ? – Adrian George Aug 21 '13 at 22:13
Go ahead and post it! – Jorge Castro Aug 21 '13 at 22:14
worth saying that while %R is like %H:%M, %r is like %I:%M:%S. So the 12h version of %R is %I:%M%p. %H:%I instead looks wrong to me (it gives you hour in 24h and hour in 12h). – Cubiq Aug 21 '13 at 22:20

Current time 24h format:

date +%R

Current time 12h format with AM/PM:

date +%I:%M%p
share|improve this answer
date +%H:%M 

for 13:45

date +%H:%M 

for 1:45


will tell how long the system has been running (along with other information) check man entry for uptime

share|improve this answer

last displays info about recent logins. See for more info about it. I think it can show shutdowns too. For the time try date +%r. See for more info on date.

share|improve this answer
I've asked the OP to repost that as a new question, when he does please post this there and then remove it from here, thanks! – Jorge Castro Aug 21 '13 at 22:09
@JorgeCastro thanks. Didn't know about that. I am newbie in linux, and I am trying to learn it and this seems the only place where I can do this. – Adrian George Aug 21 '13 at 22:10
No worries, keep on rocking! – Jorge Castro Aug 21 '13 at 22:11
Will do... Awaiting new question... – Erresen Aug 21 '13 at 22:17
@JamesCrawshaw I've posted new question here… – Adrian George Aug 21 '13 at 23:04

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.