How do I change timezone in centos 6.2?
Solution 1:
It looks like that CentOS 6.2 doesn't have any hwclock line in it /etc/rc.sysinit
, so changing /etc/sysconfig/clock
will not work.
Try tzselect
or use ln -s /usr/share/zoneinfo/xxxx /etc/localtime
Solution 2:
First use tzselect to find out which is your timezone. The final output of tzselect will be something like:
Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
America/New_York
The very last line is the name of your zoneinfo file.
Now create a symlink from /etc/localtime to the correct zoneinfo file, e.g.:
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
The -f flag is needed to overwrite the existing /etc/localtime.
Note: running tzselect won't touch anything on your system, it will just output some text. The "or" in the answer by caojun is misleading. You must use tzselect AND ln. From the tzselect manpage: "[tzselect] outputs the resulting timezone description to standard output".