skip down to the 11 comments

Setting the timezone on CentOS

I forget this pretty much all the time, even though it’s a fairly simple operation. There are loads of timezone data files stored in:

/usr/share/zoneinfo

So for my CentOS install, to set my machine to London time, I use:

#
# this is not correct for me
#
$ date
Wed Oct  1 07:43:58 CDT 2008
#
# to fix it
#
$ sudo rm /etc/localtime
$ sudo ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
#
# now check it's ok
#
$ date
Wed Oct  1 12:42:33 GMT 2008

I imagine this works on Redhat and Fedora as well, but I can’t be sure on other Linux distros.

There have been 11 responses to this post.

  1. John Trupiano

    This was helpful to me. Thanks!

  2. Jeremy Hoyland

    I linked in /usr/share/zoneinfo/Europe/London to localtime on the theory that it might get me summertime.

    I’ll find out in March!

  3. Duncan

    @jeremy you’re right :) and I’ve swapped mine too

  4. The Separator

    Fine instructions, thank you!

  5. DDevine

    I can confirm this works on CentOS 5.5. The directories are the same.

  6. Brian Berlin

    Thank you sir!

  7. Pedro

    Simple and very effective!

  8. Alexios Koumouris

    Thank you very much. Just Works.!!!

  9. Evgeny

    tnx ,very effective and helped me :-)

  10. Sergio

    Thanks! This was very usefull for me. I lost a lot of time trying to fix this problem. After I read your post, I fix it in 45 seconds.

  11. Juan Narvaez

    Hello from colombia, indeed this solution was both fast and simple to me.

    Thanks a lot for sharing


back to the top