Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

i.e.:

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
add comment

4 Answers 4

up vote 6 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
add comment

Current time 24h format:

date +%R

Current time 12h format with AM/PM:

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

for 13:45

date +%H:%M 

for 1:45

"uptime" 

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

share|improve this answer
add comment

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.

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... –  James Crawshaw 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
add comment

Your Answer

 
discard

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.