#50631 [Opn->Bgs]: strtotime() gives incorrect output for certain date
| From: | rasmus@php.net | Date: | Sat, 02 Jan 2010 06:27:09 +0000 |
| Subject: | #50631 [Opn->Bgs]: strtotime() gives incorrect output for certain date | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146273@lists.php.net to get a copy of this message | ||
ID: 50631
Updated by: rasmus@php.net
Reported By: barlow at fhtsolutions dot com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Linux or XP
PHP Version: 5.2.12
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
Instead of using mktime/date consider using gmmktime and gmdate which
do
not suffer from DST.
.
Previous Comments:
------------------------------------------------------------------------
[2010-01-02 06:04:30] barlow at fhtsolutions dot com
Description:
------------
strtotime() reports an incorrect value for a particular date:
2010-03-15
It seems to think that this day has 23 hours!
Reproduce code:
---------------
---
From manual page: function.strtotime#Description
---
<?php
$a = strtotime("2010-03-14");
$b = strtotime("2010-03-15");
echo "Number of hours difference: ".(($b-$a)/3600)."<br />";
// shows 23 ! WRONG!
// PHP Version 5.2.12
?>
Expected result:
----------------
Number of hours difference: 24
Actual result:
--------------
Number of hours difference: 23
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50631&edit=1