See the time
To see the time on Debian GNU/Linux, use the command date
To see the time in UTC, use command date -u.
Set the time manually
When setting the time manually, the time string may be confusing. The command date --set ... accepts the date and time in many formats. You can read the man page of date, or use the example below to figure out one possible format. The date is given in ISO 8601 standard format YYYY-MM-DD for Year-Month-DayOfMonth, and time of day using 24 hour clock. Leading zeros are significant.
date --set 1998-11-02 date --set 21:08:00
The above two commands set the system date to second of November, 1998, and system time to eight minutes past nine, PM.
Note, this has no effect on the underlying hardware's hardware clock. When the system next boots, it will revert back to the original date and time (relatively speaking).
Setting the hardware clock
To write the correct current system time to the hardware clock so the system comes up with the correct date and time, correct the system time as above, then see command hwclock
Set the time automatically
The protocol used to set the time is the Network Time Protocol or NTP. To set the time automatically you need access to an NTP server. Your local network may provide such a server but most people need to access an NTP server via the internet.
On the internet there are time servers that provide the correct time. Your ISP may provide a time service and this would be your closest and probably most accurate source. While there are still many independant NTP servers you can connect to, the best source is http://pool.NTP.org.
It's really quite easy on Debian.
apt-get install ntp
Because the pool is global, you should adjust
to use more local sources. Change the
where XX is your continent or two letter country code. Click on the continent to see the valid country codes. eg CA for Canada etc.
For increased accuracy you would include extra server lines such as
incrementing the number for each line. Two or three should be all you need.
If your time is too far out, NTP will assume that it has contacted a broken server and will not adjust your time. Thus it is suggested that after installing you run
You also run ntpdate on computers using dial-up.
Time Administration Tool GUI