Server Fault is a question and answer site for system and network administrators. 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 running sudo date +%m/%d/%Y -s 7/14/2010 command to change date. It changes fine except I want it to pick up the current time as well, and not start the time from 00:00:00 on 7/14/2010.

share|improve this question
up vote 6 down vote accepted

Just extend the call to include hour information too:

sudo date +"%m/%d/%Y %H:%M:%S" -s "7/14/2010 10:00:00"
share|improve this answer
Perfect, i actually needed sudo date +"%m/%d/%Y %H:%M:%S" -s "7/14/2010 date +%T" but i didn't fully understand formats – gAMBOOKa Jul 14 '10 at 10:55

If you need accurate time, use ntpdate or better run ntpd daemon:


share|improve this answer

It is often a good idea to sync the BIOS clock if there is that much of an offset after changing. This can be done via:

hwclock --systohc

Typically distributions write to BIOS on a shutdown.

share|improve this answer
+1 I've gotten into the habit of doing this any time I set the date/time. – Ward Jul 14 '10 at 22:06

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.