Bug #68492 [Opn->Nab]: Function strtotime() returns wrong values for some dates
| From: | derick@php.net | Date: | Mon, 24 Nov 2014 13:23:20 +0000 |
| Subject: | Bug #68492 [Opn->Nab]: Function strtotime() returns wrong values for some dates | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188777@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68492&edit=1
ID: 68492
Updated by: derick@php.net
Reported by: anwendungsentwickler at gmail dot com
Summary: Function strtotime() returns wrong values for some
dates
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Windows 7
PHP Version: 5.5.19
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
"24.06.08" is interpreted as 24h 06m 08s, and because there is no hour 25, that specific
rule fails and it falls back to 25d 06m 2008y.
Run:
var_dump(date_parse('24.06.08'));
to see it for yourself.
Previous Comments:
------------------------------------------------------------------------
[2014-11-24 11:46:49] anwendungsentwickler at gmail dot com
Description:
------------
The function strtotime returns in some cases wrong values - regarding to the test script:
Returns:
24.06.08 : 2014-11-25
24.06.2008: 2008-06-24
----------------------
25.06.08 : 2008-06-25
25.06.2008: 2008-06-25
Expected:
24.06.08 : 2008-06-24
24.06.2008: 2008-06-24
----------------------
25.06.08 : 2008-06-25
25.06.2008: 2008-06-25
Tested on:
5.5.11 WIN
5.5.15 WIN
5.2.17 Linux
Test script:
---------------
<pre><?php
echo "PHP VERSION: ".PHP_VERSION."\n";
for($i = 1; $i <= 30; ++$i) {
$day = str_pad($i, 2, '0', STR_PAD_LEFT);
$dateTwo = "$day.06.08";
$dateFour = "$day.06.2008";
echo $dateTwo." : ".date("Y-m-d", strtotime($dateTwo));
echo "\n";
echo $dateFour.": ". date("Y-m-d", strtotime($dateFour));
echo "\n".str_repeat('-', 22)."\n";
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68492&edit=1