php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27327 Problem with 2004-03-28 (summer time conversion)
Submitted: 2004-02-20 02:53 UTC Modified: 2004-02-23 03:02 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: timo at reflection-metal dot de Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.4, 4.3.3 OS: Suse, RedHat, WinXP, W2K
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: timo at reflection-metal dot de
New email:
PHP Version: OS:

 

 [2004-02-20 02:53 UTC] timo at reflection-metal dot de
Description:
------------
The mktime function gives strange results when adding something that results between '2004-03-28 01:00:00' and '2004-03-28 01:01:00'.

Reproduce code:
---------------
$STTDate = strToTime('2004-03-28 00:30:00');

$StrangeDate = date('Y-m-d H:i:s', mktime(date('H',$STTDate),date('i',$STTDate)+30,0,date('m',$STTDate),date('d',$STTDate),date('Y',$STTDate)));


Expected result:
----------------
2004-03-28 01:00:00

Actual result:
--------------
2004-03-28 03:00:00

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-20 03:41 UTC] timo at reflection-metal dot de
Just found out that this bug is a problem with summer time conversion. You could check out e.g. 2003-03-30...
In addition:
If you subtract 1 minute from '2004-03-28 03:00:00' it results in '2004-03-28 03:59:00'
 [2004-02-20 04:16 UTC] sniper@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.


 [2004-02-21 12:14 UTC] timo at reflection-metal dot de
Hi Sniper,
thanks for your advice... But shouldn't the daylight saving return 1 instead of 2 hours difference?
 [2004-02-21 13:03 UTC] scottmacvicar at ntlworld dot com
Can't confirm this under RH9 and Windows XP using PHP 4.3.5RC3. There was a few timezone bug fixes could you try a snapshot from http://snaps.php.net

What timezone was your server running in? I was running them in GMT.
 [2004-02-22 22:20 UTC] sniper@php.net
Can't reproduce with latest CVS / 4.2.3.
Check your timezone.

 [2004-02-23 03:02 UTC] timo at reflection-metal dot de
Just tested to switch the timezone to GMT (former CET), alas same result. Also
echo gmdate('Y-m-d H:i:s', gmmktime(0, 59+1, 0, 03, 28, 2004));
is giving '2004-03-28 03:00:00'.
Reproduced this on 6 PCs and also in PHP 4.3.3.
Unfortunately I cannot try the latest snapshot, 'cause all machines are production servers. Maybe I could get some time to setup a new one during this week.
Maybe it's nothing but a guess but:
Daylight saving time outside europe starts at 01:00:00 ('cause CET is GMT+1) and inside europe 02:00:00. Could it be that they are used BOTH?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 15:01:27 2024 UTC