php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34859 setting the TZ environment variable to EST5 doesn't work
Submitted: 2005-10-13 19:48 UTC Modified: 2005-10-13 23:17 UTC
From: mdlawler at gwmicro dot com Assigned: derick (profile)
Status: Not a bug Package: Date/time related
PHP Version: 5CVS-2005-10-13 (snap) OS: Windows
Private report: No CVE-ID: None
 [2005-10-13 19:48 UTC] mdlawler at gwmicro dot com
Description:
------------
With the current 5.1RC2 snap setting the TZ environment variable to EST5 which is the correct setting for Indiana in the US doesn't work correctly.  Setting TZ to something like EST5EDT CST6CDT, PST8PDT etc does work.

Reproduce code:
---------------
<?
$date = date("h:i:s", time());
echo "Date: $date";
?>


Expected result:
----------------
I expect to see the correct time accounting for my time zone.

Actual result:
--------------
It was actually 09:52:28 AM and the date was printed as the following PM
Date: 02:52:28
PHP Notice:  date(): Timezone setting (date.timezone) or TZ environment variable contains an unknown timezone. in E:\tz.php on line 2


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-13 20:19 UTC] tony2001@php.net
Assigned to the maintainer.
 [2005-10-13 23:17 UTC] derick@php.net
Not a bug, you need to set it to one of the constants you find on the following documentation page. This behavior changed in PHP 5.1:
http://www.php.net/manual/en/timezones.america.php
Even better would to not use the TZ env var, but isntead use the date.timezone setting in php.ini to the correct Timezone Identifier.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 04:01:32 2024 UTC