The timezone in Linux is defined in the file /etc/localtime. To change this setting you should modify the contents of this file to reflect the desired zone information. By default, the operating system will keep the zone information files for all timezones under /usr/share/zoneinfo. To set a timezone, you can either copy the file as /etc/localtime or link /etc/locatime to the target file. The preferred method is to use soft links.
I will show you how I changed the timezone in my server from PDT to IST.
Current date and timezone:
[root@www ~]# date
Sat Aug 9 09:32:11 PDT 2008
[root@www ~]# ls -l /etc/localtime
lrwxrwxrwx 1 root root 39 Aug 2 07:15 /etc/localtime -> /usr/share/zoneinfo/America/Los_Angeles
As you can see, the timezone of the system is PDT (Pacific Daylight Time) . Now I want to change this to Indian Standard Time (IST). So I am going to change the link to /etc/localtime. My timezone file will be at the location /usr/share/zoneinfo/Asia/Calcutta.
[root@www ~]# ln -sf /usr/share/zoneinfo/Asia/Calcutta /etc/localtime
[root@www ~]# date
Sat Aug 9 22:10:23 IST 2008
As you can see, the timezone is IST now.
No comments:
Post a Comment