Doc #54456 [Opn]: date_modify's $modify argument differs from the strtotime's $time argument

From: Date: Thu, 28 Apr 2011 14:52:29 +0000
Subject: Doc #54456 [Opn]: date_modify's $modify argument differs from the strtotime's $time argument
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6308@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54456&edit=1 ID: 54456 Updated by: salathe@php.net Reported by: regsd at ya dot ru Summary: date_modify's $modify argument differs from the strtotime's $time argument Status: Open Type: Documentation Problem Package: Documentation problem Operating System: Windows 7 PHP Version: 5.2.17 Block user comment: N Private report: N New Comment: This was a bug in DateTime::modify() and is fixed as of PHP 5.3.6. The docs need to be updated to make note of that change. Previous Comments: ------------------------------------------------------------------------ [2011-04-03 05:03:17] regsd at ya dot ru Description: ------------ --- From manual page: http://www.php.net/datetime.modify --- Documentation implicitly says that $modify argument of the date_modify function is equal in its meaning to the $time argument of the strtotime function, however they differ. date_modify ignores the time value specified (please see the code snippet below). Test script: --------------- <?php $time = 'next Monday 19:00'; $d = new DateTime('now'); $d->modify($time); echo $d->format('Y-m-d H:i:s') . "\n"; $t = strtotime($time); $d = new DateTime('@'.$t); echo $d->format('Y-m-d H:i:s') . "\n"; ?> Expected result: ---------------- 2011-04-04 13:00:00 2011-04-04 13:00:00 Actual result: -------------- 2011-04-04 08:55:37 2011-04-04 13:00:00 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54456&edit=1

« previous php.doc.bugs (#6308) next »