php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35763 date_default_timezone_get() returns wrong city and timezone for Australia
Submitted: 2005-12-21 15:40 UTC Modified: 2005-12-21 16:08 UTC
From: mvitnellml at swiftdsl dot com dot au Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5CVS-2005-12-21 (snap) OS: Linux Debian etch
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mvitnellml at swiftdsl dot com dot au
New email:
PHP Version: OS:

 

 [2005-12-21 15:40 UTC] mvitnellml at swiftdsl dot com dot au
Description:
------------
The following session shows date_default_timezone_get() returning the wrong city (Melbourne instead of Sydney) but more importantly, the wrong city AND timezone (ACT instead of Brisbane):

Script started on Thu 22 Dec 2005 01:17:56 EST
theta:/usr/local/php5.1-200512211130# uname -a
Linux theta.sinusoid.com 2.6.14.2 #1 SMP Tue Nov 22 15:09:19 EST 2005 i686 GNU/Linux
theta:/usr/local/php5.1-200512211130# php -v
PHP 5.1.2-dev (cli) (built: Dec 21 2005 23:35:51)
Copyright (c) 1997-2005 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2005 Zend Technologies
theta:/usr/local/php5.1-200512211130# cat printzone.php
<?php
echo date_default_timezone_get(),"\n";
?>
theta:/usr/local/php5.1-200512211130# cat /etc/timezone
Australia/Sydney
theta:/usr/local/php5.1-200512211130# php printzone.php
Australia/Melbourne
theta:/usr/local/php5.1-200512211130# tzconfig
Your current time zone is set to Australia/Sydney
Do you want to change that? [n]: y

Please enter the number of the geographic area in which you live:  

        1) Africa                       7) Australia

        2) America                      8) Europe

        3) US time zones                9) Indian Ocean

        4) Canada time zones            10) Pacific Ocean

        5) Asia                         11) Use System V style time zones

        6) Atlantic Ocean               12) None of the above


Then you will be shown a list of cities which represent the time zone
in which they are located. You should choose a city in your time zone.

Number: 7

ACT Adelaide Brisbane Broken_Hill Canberra Darwin Hobart LHI Lindeman Lord_Howe Melbourne North NSW Perth Queensland South Sydney Tasmania  Victoria West Yancowinna

Please enter the name of one of these cities or zones
You just need to type enough letters to resolve ambiguities
Press Enter to view all of them again
Name: [] Brisbane
Your default time zone is set to 'Australia/Brisbane'.
Local time is now:      Thu Dec 22 00:19:08 EST 2005.
Universal Time is now:  Wed Dec 21 14:19:08 UTC 2005.
theta:/usr/local/php5.1-200512211130# php printzone.php
Australia/ACT
theta:/usr/local/php5.1-200512211130# cat /etc/timezone
Australia/Brisbane
theta:/usr/local/php5.1-200512211130# exit
                                                                                

configure line was ./configure --with-apxs2=/usr/local/apache2/bin/apxs  (which was apache 2.0.53)


Reproduce code:
---------------
<?php
echo date_default_timezone_get(),"\n";
?>

Expected result:
----------------
The correct timezone returned, and preferably the city that has been set as the timezone for the operating system.

Actual result:
--------------
Australia/Melbourne returned, which while currently in the same timezone as Australia/Sydney, has in the past had slightly different daylight saving start/finish times.

Australia/ACT returned for a set system timezone of Australia/Brisbane, which are in different timezones, and are 1 hour different during daylight saving.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-21 16:08 UTC] derick@php.net
Not a bug, we try to guess as best as possible. In your case, simply set the configuration correctly in php.ini with the http://no2.php.net/manual/en/ref.datetime.php#ini.date.timezone option.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Dec 05 02:00:01 2025 UTC