Tuesday, October 10, 2006

Get Time and Then Set Date and Time

Get the date
# date +%T
shows hh:mm:ss

Set the date/time
# date 10102248
sets the date and time to Oct 10, 10:48 pm
# date 2251.34
sets the time to 10 hours 51 minutes 34 seconds pm

Display Date
# date
Tue Oct 10 22:49:55 KST 2006
# date '+%h %d, 20%y'
Oct 10, 2006

2 comments:

Meena said...

Thanks! it helped.

pobby69 said...

Thanks for this. Might just be worth mentioning that the logged in account needs sufficient permissions to change the date and/or time.

Might be obvious but I'm pretty new to this!