How do I change timezone in centos 6.2?

Solution 1:

It's look like that CentOS 6.2 have't any hwclock line in it /etc/rc.sysinit, so change /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".


Solution 3:

Edit the file /etc/sysconfig/clock to suit your needs.


Solution 4:

One should restart rsyslogd after changing the timezone so that the new timezone is reflected in the logs.

Do this with: service rsyslog restart