Changing time zones and time on a server
Some times it happens, that the server time zone or time is set incorrectly. Normally this doesn’t affect web applications, however for certain types of servers, that deal with external data this is very important. An example is a mail server. If time zone data is set incorrectly it will be specifying invalid data in sent messages causing email clients to show emails from the future or way back from the past.
Changing time zones on a server is easy. First you need to check which zone is configured now. This is done through the date application. It should return something like this:
Mon NovĀ 3 12:02:24 EET 2008
The TZ data files are located in /usr/share/zoneinfo. To change the TZ on the server you need to create a link from the respective TZ and replace the /etc/localtime symlink.
For example you could use
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
This will set the TZ to Berlin/Europe. After this the time will probably be broken, so you need to synchronize the time with an external server to make sure it is configured properly.
This is done with the rdate utility. You could type something like this (rdate needs to be installed first):
rdate -s time-a.nist.gov
After this you need to sync the system clock with the HW (Hardware) clock. This is done as follows:
hwclock –systohc
And now you should be done. Use the date application to verify the time and TZ.