|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44622 Australia/Victoria timezone is wrong this week
Submitted: 2008-04-02 23:58 UTC Modified: 2008-04-03 01:02 UTC
From: mikel at mikelward dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
11 + 5 = ?
Subscribe to this entry?

 [2008-04-02 23:58 UTC] mikel at mikelward dot com
On PHP 5.1.6 and 5.2.4, strftime is returning the wrong information on my Linux systems in the Australia/Melbourne timezone.

We recently had a change to the rules for daylight savings which extended daylight savings by one week from Sunday 30 March to Sunday 6 April.

The operating system has handled this change fine (using tzdata 2007k), but PHP is wrongly reporting the timezone as UTC+10 instead of UTC+11.

I have seen PHP default to Australia/Melbourne and Australia/ACT on various systems, but all of those will be at UTC+11 until this weekend.  The only timezone that is correctly UTC+10 is Australia/Brisbane.

Calling date_default_timezone_set('Australia/Melbourne') does not solve the problem.

The attached code produces the following output:
PHP time: 3 Apr 2008 9:48
shell time: 3 Apr 2008 10:48 

It shows that the system's time and timezone is correct, but PHP is doing something whacky.  Does it have its own tzdata?  (And if so why?)

Reproduce code:


$user_datetime_format = "%e %b %Y %k:%M";

$now = time();
$current_time = strftime($user_datetime_format, $now);
$offset = strftime("%z", $now);
print("PHP time: $current_time\n<br>");
print("shell time: ");
system("date \"+$user_datetime_format\"");


Expected result:
PHP time: 3 Apr 2008 10:48
shell time: 3 Apr 2008 10:48 

Actual result:
PHP time: 3 Apr 2008 9:48
shell time: 3 Apr 2008 10:48 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-03 00:31 UTC] mikel at mikelward dot com
Apparently PHP does include its own time zone database.

5.2.5 includes "2007.9".  What version of tzdata (if any) does this correspond to?

Vendors will need to issue errata packages for PHP to address every timezone change.  Certainly there's none for CentOS.

I will build my own 5.2.5 and see how it goes.
 [2008-04-03 01:02 UTC] mikel at mikelward dot com
Fixed by running "pecl upgrade timezonedb" and adding to php.ini.

I guess you're going to call this not a bug.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 03:01:28 2024 UTC