How to set your date and time in Debian
It could happen to anyone to have problems with date and time. For example I had a problem a few day’s ago with an older server of mine which has problems with hardware time, it resets everytime I disconnect it from power. Its something to do with the motherboard I changed the battery but that didn’t solved the problem. That’s why sometimes I need to correct its date with the following method:
date –set 2007-10-15
to set yyyy-mm-dd
date –set 16:47:30
to set hh-mm-ss
hwclock –systohc
to sync hardware clock to what we introduced earlier
At least from Debian version 2.2 onwards, the system automatically saves the system time to hardware clock on shutdown, and sets the system clock from hardware clock when Debian boots up. This is done in the script /etc/init.d/hwclock.sh.
Another thing you might ran into is changing the timezone.
If the timezone is not set or is wrong, log in as superuser and run tzconfig to configure the timezone.
That’s it a short tutorial about date in Debian.









October 17th, 2007 at 9:22 am
I couldn’t understand some parts of this article o.us poetry, but I guess I just need to check some more resources regarding this, because it sounds interesting.
November 11th, 2007 at 1:11 am
apt-get install ntpdate
November 22nd, 2007 at 11:10 am
ntpdate its bit harder to use than the method explained above , especially on debian ntpdate can cause problems if you dont know how to deal with it(you need a time server address to enter, etc.) for beginners is better to use the method above. ! good luck
October 29th, 2008 at 11:18 am
FYI
#date –help
Usage: date [OPTION]… [+FORMAT]
or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.
-d, –date=STRING display time described by STRING, not `now’
-f, –file=DATEFILE like –date once for each line of DATEFILE
-r, –reference=FILE display the last modification time of FILE
-R, –rfc-2822 output date and time in RFC 2822 format
–rfc-3339=TIMESPEC output date and time in RFC 3339 format.
TIMESPEC=`date’, `seconds’, or `ns’ for
date and time to the indicated precision.
-s, –set=STRING set time described by STRING
so either date -s, or date –set
H.
October 29th, 2008 at 11:20 am
Ok, sorry! I see that your blog-software breaks a double hyphen – -… Please don’t post syntax!
October 29th, 2008 at 11:28 am
Henk it’s strange on “-help” its one hyphen and on “–utc” its two.
Readers should know that they have to type double hyphen “–help”
March 15th, 2009 at 2:09 pm
Thanks!
July 6th, 2009 at 8:36 am
It should be like this
date –-set 16:47:30
to set hh-mm-ss
hwclock –-systohc
to sync hardware clock to what we introduced earlier
means we have to a one more -
October 20th, 2009 at 5:15 pm
thanks , it was helpful …
manuals dint give it so easy