Knowledgebase: Site Functions
Change Your System Time Zone
Posted by on 27 August 2013 07:51 PM

Change System Time Zone 

The time zone used on your Linux system is set in the /etc/localtime file. To replace the /etc/localtime file with the correct time zone file for the time zone you need:

  1. Make a backup of the existing localtime file mv /etc/localtime /etc/localtime.bkp
  2. Find your correct time zone file in /usr/share/zoneinfo
  3. Create the symlink: ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime 
    Note: this configuration is for Central timezone 
  4. Test your time zone change by running the 'date' command from command line

    Now it should report the correct time, date, and time zone that you set it to.

You can also run 'hwclock' command via command line to view the hardware clock and verify that it matches the correct time displayed by the 'date' command. If the two time zones don't match, then correct the hardware clock by running 'hwclock --systohc' command, which will set the hardware clock to the systems time or vice versa ('hwclock --hctosys') to set the system time from the hardware clock.

If you need additional assistance with this then please open a support request!

Changing PHP's Timezone

PHP's time zone is set by changing or adding the date.timezone variable in /usr/local/lib/php.ini or your custom php.ini file, if your using one. Changing the system time zone above does not apply to PHP if the date.timezone setting in PHP is set to something different than the system.

Example: date.timezone="America/Chicago"

Add the above line to the end of the php.ini file (with your time zone) and restart Apache for the change to take effect. If your using a custom php.ini file then no restart is necessary.

Supported Timezones in PHP

Africa
America
Antartica
Arctic
Asia
Atlantic
Australia
Europe
Indian
Pacific
Others 

Full list of countries/zones can be found here http://php.net/manual/en/timezones.php


(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
Help Desk Software by Kayako fusion