Knowledgebase: How-To
Change Your System Time Zone
Posted by on 27 August 2013 07:48 PM

The time zone used on your Linux system is set in the '/etc/localtime' file. To replace the 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!

Change 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

(1 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
ERROR: This domain name (kb.asmallorange.com), does not match the domain name in the license key file help.asmallorange.com.

For assistance with your license, please contact the Kayako support team: https://support.kayako.com