php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #54456 date_modify's $modify argument differs from the strtotime's $time argument
Submitted: 2011-04-03 05:03 UTC Modified: 2011-04-29 14:21 UTC
From: regsd at ya dot ru Assigned: salathe (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.2.17 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: regsd at ya dot ru
New email:
PHP Version: OS:

 

 [2011-04-03 05:03 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-28 16:52 UTC] salathe@php.net
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.
 [2011-04-29 14:20 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=310652
Log: added changelog for absolute datetime::modify strings (doc #54456, related r306392)
 [2011-04-29 14:21 UTC] salathe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: salathe
 [2011-04-29 14:21 UTC] salathe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 08:01:29 2024 UTC