This article applies to:
[ Zend Server for IBM i, Zend Core for i5/OS ]
[ IBM System i, i5/OS ]
Overview
PHP scripts return the wrong time of day, unless the time zone is set correctly. This is sometimes noticed on the Zend Platform Administrative Interface.
This article explains how to set the correct time zone for i5/OS and for PHP.
Instructions
Set the time zone for i5/OS.
To set the time zone on your i5, please set the system value QTIMZON. Some available values are:
| Timezone |
Value to use |
| ET |
QN0500EST3 |
| CT |
QN0600CST2 |
| MT |
QN0700MST3 |
| PT |
QN0800PST2 |
For example, if you are in the Pacific time zone, you would use this command:
CHGSYSVAL SYSVAL(QTIMZON) VALUE(QN0800PST2)
If you change this value, you should also reset system value QTTIME to the correct time, using a six digit 24 hour time. For example, if the time is 4:35 in the afternoon:
CHGSYSVAL SYSVAL(QTIME) VALUE('163500')
You can find a complete list of supported time zones at IBM i info center - Timezone . Select a time zone that shows a DST start of "Second Sunday in March at 02:00 a.m."
Set the default time zone for PHP
To set the time zone for PHP, For Zend Server, please go into the Zend Server Administrative interface in your browser, navigate to Server Setup | Extensions, and click the 'Directives' link for the date extension.
For Zend Core, please go into the Zend Core Administrative interface in your browser, and navigate to Configuration | Extensions, and expand the 'date - Date module' extension settings by clicking the adjacent plus sign.
Set the time zone (date.timezone) using the country/city code appropriate for your area:
| Timezone |
Value to use |
| ET |
America/New_York |
| CT |
America/Chicago |
| MT |
America/Denver |
| PT |
America/Los_Angeles |
For example, if you are in the Pacific time zone, use the value America/Los_Angeles. Do not enclose the value in quotes. You must restart Apache for this change to take affect.
You can find a complete list of supported time zones at List of Supported Time Zones .
Setting the time zone in your script
You can override the default PHP time zone by using the date_default_timezone_set() function in your script. Details can be found in the PHP Manual at PHP Manual date_default_timezone_set function .