|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #78000 Missing description of reltext's different behaviors (static & method on object)
Submitted: 2019-05-10 14:22 UTC Modified: 2019-05-10 16:49 UTC
From: ssimo3 at lsuhsc dot edu Assigned:
Status: Verified Package: Date/time related
PHP Version: Irrelevant OS:
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.
Block user comment
Status: Assign to:
Bug Type:
From: ssimo3 at lsuhsc dot edu
New email:
PHP Version: OS:


 [2019-05-10 14:22 UTC] ssimo3 at lsuhsc dot edu
From manual page:

What is missing is the following paragraph:

"The referent of the reltext keywords depend on the context in which the relative format string is used. If used with a static method or function, the referent is the current system timestamp. However, if used in DateTime::modify() or DateTimeImmutable::modify(), the referent is the object on which the modify() method is called."

Thank you! 

Test script:
header("Content-Type: text/plain");
$thisMonthDateTime = date_create("first day of this month");
echo $thisMonthDateTime->format("Y-m-d") . "\r\n";
$januaryDateTime = DateTime::createFromFormat("Y-m-d", "2019-01-15");
$januaryDateTime->modify("first day of this month");
echo $januaryDateTime->format("Y-m-d");

Actual result:
The two displayed dates are different, AS THEY SHOULD BE. What is missing is DOCUMENTATION of the behavior.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-05-10 16:49 UTC]
-Summary: Description of reltext behavior +Summary: Missing description of reltext's different behaviors (static & method on object) -Status: Open +Status: Verified -Operating System: Windows 10 x64 +Operating System: -PHP Version: 7.3.5 +PHP Version: Irrelevant
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Sep 29 21:01:24 2020 UTC