Follow

How do I change the time zone on my server?

  • Applies to: Grid
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: AccountCenter access or SSH / FTP access
  • Applies to: Legacy DV & VPS Hosting
    • Difficulty: Medium
    • Time: 10
    • Tools needed: SSH or Plesk administrator access
  • Applies to: VPS Hosting
    • Difficulty: Medium
    • Time: 10
    • Tools needed: SSH, Plesk administrator, or cPanel access

Overview

Follow these instructions to change the time zone on your Grid.

Instructions

  1. Sign into the AccountCenter.
  2. Navigate to the File Manager.
  3. Click on the /etc folder.
    ac-1.png
  4. Click on the php.ini file. If this is your first time editing this file, it may be listed as php.ini.sample.

    ac-2.png
  5. Once the file is open, add the following to any blank line underneath [PHP]:

     

    Filename: php.ini

    
                date.timezone="Atlantic/Bermuda"
              

     

    Please note that this would set the timezone to Bermuda (-4 UTC), modify the timezone to whatever you would like it to be. For a list of timezones that PHP supports, visit this PHP website.

  6. If the file is called php.ini.sample, change it to php.ini in the file name text box. Then click SAVE.

    ac-3.png

You can verify that the new timezone is set properly by setting up and viewing a PHP Info page on your Grid.

Resources

Follow these instructions to change the time zone on your VPS Server.

Instructions

Plesk

The following article is using Plesk Obsidian (18.0.24):

  1. Log into the Plesk Control Panel for your domain.

    p-0.5.png

  2. On the left-menu, click on Tools & Settings.

    p-1.png

  3. Under General Settings, click on System Time.

    p-2.png

  4. Change the desired timezone from the drop-down menu. Then click OK.

    p-3.png

  5. Reboot your server.

This will update your server's time zone. You do not need to restart Plesk or your server as a whole. However, if you want your databases to reflect the change, you will need to restart MySQL. See Restart Plesk services for details.

TIP:
Remember that all timestamps, including existing ones, will now reflect the new time zone.

cPanel

  1. Log into WHM.
  2. From the left-menu, under Server Configuration, click on Server Time.

    whm-1.png


  3. Select the desired time zone from the drop-down menu. Then click Change Time Zone.
    • If you find that your time zone is correct, but the server is out of sync, then click Sync Time with Time Server.

      whm-2.png

  4. Reboot your server.
  5. That's it! Your timezone should now be updated.

Command line

You cannot change the system time on a DV because all the virtualized servers on the actual physical server can have only one system time. However, it is possible to change the default system timezone for your DV with the tzselect command.

You will be prompted to select several time zone options. This example will select Pacific Time.

Please identify a location so that time zone rules can be set correctly.
  Please select a continent or ocean.
   1) Africa
   2) Americas
   3) Antarctica
   4) Arctic Ocean
   5) Asia
   6) Atlantic Ocean
   7) Australia
   8) Europe
   9) Indian Ocean
  10) Pacific Ocean
  11) none - I want to specify the time zone using the Posix TZ format.
  #?

Enter your desired region:

2

  Please select a country.
   1) Anguilla		     27) Honduras
   2) Antigua & Barbuda	     28) Jamaica
   3) Argentina		     29) Martinique
   4) Aruba		     30) Mexico
   5) Bahamas		     31) Montserrat
   6) Barbados		     32) Netherlands Antilles
   7) Belize		     33) Nicaragua
   8) Bolivia		     34) Panama
   9) Brazil		     35) Paraguay
  10) Canada		     36) Peru
  11) Cayman Islands	     37) Puerto Rico
  12) Chile		     38) St Barthelemy
  13) Colombia		     39) St Kitts & Nevis
  14) Costa Rica		     40) St Lucia
  15) Cuba		     41) St Martin (French part)
  16) Dominica		     42) St Pierre & Miquelon
  17) Dominican Republic	     43) St Vincent
  18) Ecuador		     44) Suriname
  19) El Salvador		     45) Trinidad & Tobago
  20) French Guiana	     46) Turks & Caicos Is
  21) Greenland		     47) United States
  22) Grenada		     48) Uruguay
  23) Guadeloupe		     49) Venezuela
  24) Guatemala		     50) Virgin Islands (UK)
  25) Guyana		     51) Virgin Islands (US)
  26) Haiti
  #?

Select a country:

47

  Please select one of the following time zone regions.
   1) Eastern Time
   2) Eastern Time - Michigan - most locations
   3) Eastern Time - Kentucky - Louisville area
   4) Eastern Time - Kentucky - Wayne County
   5) Eastern Time - Indiana - most locations
   6) Eastern Time - Indiana - Daviess, Dubois, Knox & Martin Counties
   7) Eastern Time - Indiana - Starke County
   8) Eastern Time - Indiana - Pulaski County
   9) Eastern Time - Indiana - Crawford County
  10) Eastern Time - Indiana - Switzerland County
  11) Central Time
  12) Central Time - Indiana - Perry County
  13) Central Time - Indiana - Pike County
  14) Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties
  15) Central Time - North Dakota - Oliver County
  16) Central Time - North Dakota - Morton County (except Mandan area)
  17) Mountain Time
  18) Mountain Time - south Idaho & east Oregon
  19) Mountain Time - Navajo
  20) Mountain Standard Time - Arizona
  21) Pacific Time
  22) Alaska Time
  23) Alaska Time - Alaska panhandle
  24) Alaska Time - Alaska panhandle neck
  25) Alaska Time - west Alaska
  26) Aleutian Islands
  27) Hawaii
#?

Select a time zone:

21

  The following information has been given:

  	United States
  	Pacific Time

  Therefore TZ='America/Los_Angeles' will be used.
  Local time is now:	Fri Feb 27 10:08:21 PST 2009.
  Universal Time is now:	Fri Feb 27 18:08:21 UTC 2009.
  Is the above information OK
  1) Yes
  2) No
  #?

Confirm your choice:

1

  You can make this change permanent for yourself by appending the line
  	TZ='America/Los_Angeles'; export TZ
  to the file '.profile' in your home directory; then log out and log in again.

  Here is that TZ value again, this time on standard output so that you
  can use the /usr/bin/tzselect command in shell scripts:
  America/Los_Angeles
  1. Log into your server as root or a sudo user via SSH.
  2. Run the following command to bring up your time zone options:
    tzselect
  3. View the results. In this example, it is America/Los_Angeles.
  4. Back up your current localtime file:
    mv /etc/localtime /etc/localtime.orig
  5. Make a symbolic link from /etc/localtime to America/Los_Angeles (be sure to use your own time zone result from Step 3 above):
    ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
  6. Test that the change was successful by running the date command:
    date

    You should see results for your new time zone:

    Tue Feb 21 11:23:27 PST 2012

PHP

Changing the time zone of your server control panel, does not necessarily mean changing the time zone of PHP. To do that, you will want to follow the instructions below:

  1. Navigate to your php.ini file.
  2. Input the following directive:
     date.timezone="Atlantic/Bermuda"

    Please note that this would set the timezone to Bermuda (-4 UTC), modify the timezone to whatever you would like it to be. For a list of timezones that PHP supports, visit this PHP website.

Was this article helpful?
1 out of 1 found this helpful

Comments