>

CentOS: Need to change your timezone?

Problems with your system time?

So, you just got your new remote server setup, but something seems off? Oh, it’s the time. The times listed in your log files seem wrong, or maybe the modification time on your files. Perhaps your server is using the wrong time zone for your tastes. You can check by running the “date” command.

$ date
Wed Dec  5 05:59:11 UTC 2012

UTC? That’s not what I want! There’s a good chance the /etc/localtime is linked to the wrong timezone, or worse maybe it’s not linked at all. Maybe it’s a copy of the wrong time zone file? Well the fix is easy. In my case, I want the Pacific time zone, specifically Los Angels. First I backup the original file, because that what I always do. Then I I look through /usr/share/zoneinfo to find the correct file. Lastly, I create a link to the correct file.

The reason I create a link, instead of copying the file, is that system updates may update the time zone files, if they mess with Daylight Savings time again. By creating a link, those updates are automatically applied.

$ sudo mv /etc/localtime /etc/localtime.bak
$ sudo ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

Ok, this looks better!

$ date  
Tue Dec  4 22:02:05 PST 2012
banner ad

Comments are closed.