Doc #54456 [NEW]: date_modify's $modify argument differs from the strtotime's $time argument
| From: | regsd at ya dot ru | Date: | Sun, 03 Apr 2011 03:03:18 +0000 |
| Subject: | Doc #54456 [NEW]: date_modify's $modify argument differs from the strtotime's $time argument | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-6177@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows 7
PHP version: 5.2.17
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:date_modify's $modify argument differs from the strtotime's $time argument
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 bug report at http://bugs.php.net/bug.php?id=54456&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54456&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54456&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54456&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54456&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54456&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54456&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54456&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54456&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54456&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54456&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54456&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54456&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54456&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54456&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54456&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54456&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54456&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54456&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54456&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54456&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54456&r=mysqlcfg