We can find the timezone information of the system, using the linux command “date”. The “date” command shows the current date, time and timezone of the system as follows.
Mon Sep 24 16:01:50 EDT 2012
In order to view the timezone information only, you can use the date command as follows.
# date +%Z
This actually refers to the kernel’s software clock.
If you want to change the timezone of your system, you can do it in following two ways.
1. By using “date” command
To set the time manually, do this:
# date -s "16:15:00"
Mon Sep 24 16:15:00 CST 2012
2. Modifying /etc/localtime
The file “/etc/localtime” defines the current timezone of the server. All available timezone information files are available under the directory “/usr/share/zoneinfo”. In order to set the timezone of the system to “America/New_York”, you need to remove the file “/etc/localtime” and create a symbolic link to the zoneinfo file as follows.
# rm /etc/localtime
# ln –s /usr/share/zoneinfo/America/New_York /etc/localtime
There is a hardware clock also, which is normally used to set the system clock at boot time. The file “/etc/sysconfig/clock” sets whether the hardware clock is set as UTC or localtime.
You can view the current time of hardware clock as follows.
# hwclock –show
If you want to update the hardware clock from the system clock, you need to execute the following.
# hwclock –systohc --utc