I travel a lot and I have noticed that the timezone on my mac book wasn’t updating properly. I was getting lots of wrong meeting times in Outlook and various other apps that depend on time. I was getting pretty annoyed at this and decided to figure out what was up. I was pretty sure this was supposed to happen automatically so I decided to have a look and figure out what was going on.
I recently upgraded a CentOS Linux servers PHP from 5.2.X to 5.3.X and ran into a couple minor issues along the way. One of the issues was the fact that one of my applications was complaining about PHP’s date function by letting me know that it could not rely on the system’s timezone setting. Fixing this problem is extremely easy and can most likely be resolved by a quick edit to the servers php.ini file as described in detail below.
Changing the timezone on Linux is easy. The timezone within Linux is set by a symbolic link located in the /etc directory which needs to be changed to the new timezone. Once this is changed the time needs to be synced to a time server. I recently moved from Las Vegas to Louisville and had not changed a Linux server to the new timezone. Follow the steps below and the new timezone will be set and updated.
- Backup Current Timezone: Issue the below command on your server to backup the current timezone information just in case there are issues.
- cp -p /etc/localtime /etc/localtime.bak