How to update the timezone of a server


Linux

*Note: Applies to CentOS 5.x and 6.x servers

If Plesk is installed, change the timezone in Plesk first.

  • Log in to Plesk and go to Server Management > Tools & Settings, then click "System time" under the General Settings category.
  • Set the timezone in the dropdown next to "Your time zone"

If Plesk is not installed, follow the below steps. You should also follow these steps if Plesk is installed, to ensure it is changed correctly.

  • Check if /etc/localtime is a symlink, and if it points to the correct timezone. For example, a server set to "America/Phoenix":
# ls -lah /etc/localtime
lrwxrwxrwx 1 root root 35 Nov 30 04:47 /etc/localtime -> /usr/share/zoneinfo/America/Phoenix
  • Check /etc/sysconfig/clock and if contains a line that starts with ZONE=, make sure it is updated to match as well.
ZONE="America/Phoenix"
  • Check if PHP is set to the same timezone
    • # php -i | grep date.timezone
    • If you see "no value" for date.timezone, then you should add the appropriate line to your php.ini
    • date.timezone = 'America/Phoenix'
    • Restart httpd for the change to take effect
  • Finally, check the 'date' command through ssh and make sure you get the appropriate time and timezone.
  • Assuming it is correct, you may want to reboot the server or at least restart all of the services that you are able.

Ubuntu Servers

If you are running a Ubuntu server, the above advice is still valid regarding Plesk, and php. In order to change the timezone, you will need to run the following command through SSH:

dpkg-reconfigure tzdata

Once it comes up, follow the directions to set the timezone.

You can also manually edit /etc/timezone to contain the new timezone.

Windows

If Plesk is installed, change it in Plesk first.

  • Log in to Plesk and go to Server Management > Tools & Settings, then click "System time" under the General Settings category.
  • Set the timezone in the dropdown next to "Your time zone"

If Plesk is not installed, or you want to manually update the timezone.

  • Open "Date and Time" in the control panel, or by right clicking the clock in the system tray, and then clicking "Adjust date/time"
  • To change your time zone, click the Time Zone tab. In the box above the map, click the drop-down arrow, and then click your current time zone.
  • If you make use of PHP on Windows, you will need to make sure you have a line similar to "date.timezone = 'America/Phoenix'" in your php.ini


This article has been provided by Codero Hosting, the leading provider of reliable dedicated, managed and cloud hosting services. Need more information on this topic or to learn more about Codero’s hosting services please visit 
www.codero.comchat with us online or give us a call at 866-2-CODERO.

Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)