Here is the output of my date command:

[root@r1304 ~]# date
Wed Apr 18 15:43:28 GST 2012

I want to change the default system timezone to Asia/Dubai. I've followed a tutorial and did this:

ln -sf /usr/share/zoneinfo/Asia/Dubai /etc/localtime

But with no effect. Seems that this is done differently in CentOS 6. How do I change the timezone?

  • This shouldn't be so complex... – ewwhite Nov 25 '12 at 0:21

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

  • 5
    Thanks, that worked for me. My solution was rm /etc/localtime && ln -s /usr/share/zoneinfo/America/New_York /etc/localtime. – Banjer Feb 3 '13 at 21:00
  • What's better to use for this - ln or cp? – XåpplI'-I0llwlg'I - Sep 9 '14 at 12:28
  • In this case, using a symlink is probably better than copying the file – JDS Oct 21 '14 at 15:13
  • 2
    Do this, but also make sure to update the /etc/sysconfig/clock with the correct timezone as updates can and will change localtime back to what is in the clock. – Justin Mar 19 '15 at 16:21
  • ln -s is better than cp because if the tzdata package updates the zone file for your region you will see the changes without having to copy it again. – David Purdue Nov 10 '15 at 2:50

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:

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".


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

  • 1
    That's not a complete solution. You need to set the timezone offset. – ewwhite Nov 25 '12 at 0:47
  • 5
    although this is not a complete answer, this step is quite essential. without updating sysconfig/clock (something we did not do when changing timezones)... running certain yum updates / installs (unsure which ones), will cause the timezone to revert to the one listed in sysconfig/clock... regardless of what /etc/localtime was replaced with. so yea... make sure to update sysconfig/clock to make your timezone change stick. – anonymous-one Mar 19 '13 at 13:07
  • 1
    Yum update can cause a disaster in case /etc/localtime and /etc/sysconfig/clock point to two different timezones. Updating mysql for instance can cause a nice time shift in all the dates. – elbuild Oct 19 '14 at 17:40

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

Do this with: service rsyslog restart


Simple tutorial, try this..

[root@dlp ~]# vi /etc/sysconfig/clock

# change to your location

[root@dlp ~]# source /etc/sysconfig/clock # reload
# copy your timezone file under the "/usr/share/zoneinfo" like follows
[root@dlp ~]# cp -p /usr/share/zoneinfo
  • this worked for me, other options didn't – Bokw Sep 18 '13 at 7:20
  • 1
    If these instructions work at all, it'd be good to explain why ... I see no reason why sourcing /etc/sysconfig/clock would have any effect on the subsequent cp program (or indeed, on any subsequent program) – offby1 Aug 25 '14 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.