:::: MENU ::::

CentOS Change Timezone

After installing CentOS we sometimes see that the date is not in our desired timezone, instead it defaulted to the PST timezone.

Correcting your timezone is an easy operation, so here is a quick guide to change your CentOS timezone configuration file.

Firstly you’ll need to know your timezone and/or country, a list can be found in /usr/share/zoneinfo/

The more generic procedure to change the timezone is to create a symlink to file /etc/localtime

OR you can copy and replace the current localtime setting

To verify that your timezone is changed use the date command:


  • http://twitter.com/ngoulas Nick Goulas

    thanks

  • Phoenixillusion

    To the point and extremely quick! good stuff

  • GioMBG

    dosen’t work on centos 6 php 5.3

  • Talsibo

    works perfect!

  • GioMBG

    on centos minimal 6.2 the correct operation was:
    service ntpd start
    chkconfig ntpd on

  • Junix88

    excellent!

    thanks

  • http://www.anacondawebhosting.com/ anacondaweb

    Thanks!!

  • asdfasdf

    works on centos 5.8 great

  • Laxmansingh

    Hi,

    cp /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime

    or

    ln -sf /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime

    One more point you need to add in post is:

    if  copy or create symlink but zone change not reflecting than

    yum search tzdata

    yum update tzdata

    than execute date command.

    you get the correct time zone.

    if  

  • http://philrosenstein.myopenid.com/ philrosenstein

    thanks for the hint to update tzdata, that’s what I needed :)

  • vij

    Thanks .. :)

  • Shaul

    what about /etc/sysconfig/clock ?
    I have to change it too?

  • Ashish

    you can use either of the methods….better to make changes in /etc/sysconfig/clock

  • http://twitter.com/gbelrose Guillaume Belrose

    Thanks very useful. Coincidently I was also changing the time zone from Johannesburg.

  • anonymous-one

    Its not just “you can use any method”… If you dont set the correct timezone in sysconfig/clock, then when you do certain actions (such as yum upgrades that upgrade tzconfig packages, amongs other things)… your timezone will revert to whatever is in sysconfig/clock… so yes, the ln method works… but make sure to do both.

  • Ray

    Thanks, it worked (CentOs 6). Appreciate it.

  • carlosspohr

    Works like a charm!

    All @digitalocean droplets has been UTC by default…now I have a skell configured for new droplets :)