php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39248 strftime("%z") inconsistant in non-GMT zones.
Submitted: 2006-10-24 18:53 UTC Modified: 2006-10-24 19:07 UTC
From: Lhunath at Pandora dot Be Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.1.6 OS: Gentoo Linux 2.6.18
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: Lhunath at Pandora dot Be
New email:
PHP Version: OS:

 

 [2006-10-24 18:53 UTC] Lhunath at Pandora dot Be
Description:
------------
The time zone used to generate formatted time from a timestamp changes depending on the timestamp itself, unless if the timezone is set to GMT.

Reproduce code:
---------------
date_default_timezone_set("Europe/Brussels");

$time=1162072800;
print(strftime("%c %z", $time))."\n";

$time+=86400;
print(strftime("%c %z", $time))."\n";

Expected result:
----------------
The two lines should reflect a time with 24 hours difference. Both lines should display the time as defined by the selected timezone (Which in the example code is 'Europe/Brussels', which is +0100).

Actual result:
--------------
The two lines reflect a time with 24 hours difference, but they are formatted in different time zones. The first is obviously not in the correct timezone ('Europe/Brussels'), even though the timezone was set correctly.

Sun Oct 29 00:00:00 2006 +0200
Sun Oct 29 23:00:00 2006 +0100


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-24 19:07 UTC] tony2001@php.net
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which do
not suffer from DST.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 21:00:02 2026 UTC