#19875 [Opn]: date/strtotime fails around time change
| From: | beryrinaldo at mac dot com | Date: | Sat, 12 Oct 2002 02:37:26 +0000 |
| Subject: | #19875 [Opn]: date/strtotime fails around time change | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-22189@lists.php.net to get a copy of this message | ||
ID: 19875
User updated by: beryrinaldo@mac.com
-Summary: date fails around time change
Reported By: beryrinaldo@mac.com
Status: Open
Bug Type: Date/time related
Operating System: Linux
PHP Version: 4.2.3
New Comment:
Updated summary line.
Previous Comments:
------------------------------------------------------------------------
[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