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?

  • 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
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.

|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
  • date +%T in case you want seconds as well – Jay Dec 5 '19 at 14:32

Current time 24h format:

date +%R

Current time 12h format with AM/PM:

date +%I:%M%p
|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

|improve this answer|||||

I use this:

date +%T

for nanoseconds use this:

date +%T.%N

Example outputs:

vlad@vlcomp:~$ date +%T
vlad@vlcomp:~$ date +%T.%N
|improve this answer|||||

last displays info about recent logins. See http://linux.about.com/library/cmd/blcmdl1_last.htm for more info about it. I think it can show shutdowns too. For the time try date +%r. See http://linux.about.com/od/commands/l/blcmdl1_date.htm for more info on date.

|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 askubuntu.com/questions/335592/… – Adrian George Aug 21 '13 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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