Change the timezone on CentOS
Posted September 14th, 2011 in Linux/Unix/BSD and Quick Tips
I recently needed to set up a CentOS 5 box and completely forgot how to set the timezone. There's apparantly a nice easy text GUI for doing it in RHEL but I couldn't find the same thing on the CentOS box so here's how to do it. It should also work for most Linux systems.
Set the timezone on CentOS
The timezone files are located at /usr/share/zoneinfo and you simply need to create a symbolic link from /etc/localtime to point to the correct timezone file, located under that directory.
For example, I needed to set it to Auckland's time, which is done as follows:
ln -sf /usr/share/zoneinfo/Pacific/Auckland /etc/localtime
Good oh, that now saves me from having to Google how to do it next time ;)
No, I probably won't remember without having to look it up here again...
Related posts:
- Set the timezone on Debian 5 Lenny (Thursday, December 30th 2010)
- How to get the timezone offset with Javascript (Tuesday, February 17th 2009)
- Changing the timezone with PHP (Wednesday, December 31st 2008)
- Setting the MySQL timezone per connection (Saturday, December 20th 2008)
- Correcting the PHP timezone (Sunday, March 16th 2008)

Comments
blog comments powered by Disqus