ID: 46930
Updated by: [email protected]
Reported By: for-bugs at hnw dot jp
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: any
PHP Version: 5.3.0alpha3
-Assigned To:
+Assigned To: derick
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