#46930 [Asn]: 5.3.0alpha3's strtotime() returns inconsistent result with some relative items
| From: | derick@php.net | Date: | Tue, 23 Dec 2008 14:14:09 +0000 |
| Subject: | #46930 [Asn]: 5.3.0alpha3's strtotime() returns inconsistent result with some relative items | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-1659@lists.php.net to get a copy of this message | ||
ID: 46930
Updated by: derick@php.net
Reported By: for-bugs at hnw dot jp
Status: Assigned
-Bug Type: Date/time related
+Bug Type: Documentation problem
Operating System: any
PHP Version: 5.3.0alpha3
Assigned To: derick
New Comment:
5.3 does the proper behavior.
Previous Comments:
------------------------------------------------------------------------
[2008-12-22 23:09:18] for-bugs at hnw dot jp
Description:
------------
strtotime() of PHP 5.3.0alpha3 returns inconsistent and incompatible
result with 'first day' 'last day' 'previous week' 'next
week'.
PHP 5.2.8 produces consistent result, and meaning of 'first' 'next'
'last' 'previous' is clear for me.
The behaviour of PHP 5.3.0's strtotime() is sometimes natural, but it
lacks consistency and documentation, I think.
Reproduce code:
---------------
<?php
var_dump(date("Y-m-d", strtotime("20081224 first day")));
var_dump(date("Y-m-d", strtotime("20081224 next day")));
var_dump(date("Y-m-d", strtotime("20081224 last day")));
var_dump(date("Y-m-d", strtotime("20081224 previous day")));
var_dump(date("Y-m-d", strtotime("20081224 first week")));
var_dump(date("Y-m-d", strtotime("20081224 next week")));
var_dump(date("Y-m-d", strtotime("20081224 last week")));
var_dump(date("Y-m-d", strtotime("20081224 previous week")));
Expected result:
----------------
string(10) "2008-12-25"
string(10) "2008-12-25"
string(10) "2008-12-23"
string(10) "2008-12-23"
string(10) "2008-12-31"
string(10) "2008-12-31"
string(10) "2008-12-17"
string(10) "2008-12-17"
Actual result:
--------------
string(10) "2008-12-01"
string(10) "2008-12-25"
string(10) "2008-12-31"
string(10) "2008-12-23"
string(10) "1970-01-01"
string(10) "2008-12-29"
string(10) "2008-12-15"
string(10) "2008-12-15"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46930&edit=1