php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40202 Arizona timezone detected as America/Denver
Submitted: 2007-01-23 04:41 UTC Modified: 2007-01-23 14:28 UTC
From: ajb at blyler dot cc Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.0 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ajb at blyler dot cc
New email:
PHP Version: OS:

 

 [2007-01-23 04:41 UTC] ajb at blyler dot cc
Description:
------------
When the timezone (/etc/localtime) is set to Arizona time a call to date_default_timezone_get() returns America/Denver.

Which causes the date/time functions in php to incorrectly return date/time data since Arizona does not observe daylight savings.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-23 08:15 UTC] derick@php.net
So set the correct time zone in php.ini:
http://no.php.net/manual/en/ref.datetime.php#ini.date.timezone
 [2007-01-23 14:15 UTC] ajb at blyler dot cc
Setting the time zone in the php.ini file works just fine.  

But why doesn't php detect that /etc/localtime is set to Arizona's time zone?  I would think that php would detect Arizona's time zone as America/Phoenix and not America/Denver.  Since these time zones are different.
 [2007-01-23 14:28 UTC] derick@php.net
I am aware that they are different, but we can not rely on the /etc/localtime link, as that is something extremely distribution and OS dependent. Now, in order for PHP to detect which timezone it is in, it uses a few parameters: offset to GMT combined with DST, and the abbreviation. At the moment, all of these parameters are the same for both locations:

derick@kossu:~$ TZ=America/Denver date +"%z %Z"
-0700 MST
derick@kossu:~$ TZ=America/Phoenix date +"%z %Z"
-0700 MST

and then we just have to pick one.
Please remember, that making the setting is the correct way of doing things. The detection is there just to take care of BC issues as much as possible.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Aug 17 03:00:03 2025 UTC