#19875 [Opn->Bgs]: date/strtotime fails around time change
| From: | sniper@php.net | Date: | Sat, 12 Oct 2002 02:53:27 +0000 |
| Subject: | #19875 [Opn->Bgs]: date/strtotime fails around time change | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-22190@lists.php.net to get a copy of this message | ||
ID: 19875
Updated by: sniper@php.net
Reported By: beryrinaldo@mac.com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Linux
PHP Version: 4.2.3
New Comment:
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Previous Comments:
------------------------------------------------------------------------
[2002-10-11 21:37:26] beryrinaldo@mac.com
Updated summary line.
------------------------------------------------------------------------
[2002-10-11 21:36:26] beryrinaldo@mac.com
Here is a short script:
<?php
$goodday = mktime(0,0,0,10,20,2002);
$goodsun = strtotime("Sun",$goodday);
$goodmon = strtotime("Mon",$goodday);
$gooddif = $goodmon - $goodsun;
$goodsunstr = date("Ymd.Hi",$goodsun);
$goodmonstr = date("Ymd.Hi",$goodmon);
print "$goodday $gooddif $goodsunstr $goodmonstr <br>\n";
$okday = mktime(0,0,0,10,27,2002);
$oksun = strtotime("Sun",$okday);
$badmon = strtotime("Mon",$okday);
$okdif = $badmon - $oksun;
$oksunstr = date("Ymd.Hi",$oksun);
$badmonstr = date("Ymd.Hi",$badmon);
print "$okday $okdif $oksunstr $badmonstr <br>\n";
echo "PHP version " . phpversion() . " <br>\n";
?>
The output of the script is this:
1035097200 86400 20021020.0000 20021021.0000
1035702000 86400 20021027.0000 20021027.2300
PHP version 4.2.3
Although the difference between Sunday (Oct 27) and Monday is 24 hours,
the output from date shows it to be only 23.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19875&edit=1