|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-12-23 14:14 UTC] derick@php.net
[2009-05-03 14:45 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sun Jan 11 11:00:01 2026 UTC |
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"