#46930 [Opn->Asn]: 5.3.0alpha3's strtotime() returns inconsistent result with some relative items

From: Date: Tue, 23 Dec 2008 11:31:40 +0000
Subject: #46930 [Opn->Asn]: 5.3.0alpha3's strtotime() returns inconsistent result with some relative items
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-132260@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: 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

« previous php.bugs (#132260) next »