Doc #78000 [Opn->Ver]: Missing description of reltext's different behaviors (static & method on object)

From: Date: Fri, 10 May 2019 16:49:30 +0000
Subject: Doc #78000 [Opn->Ver]: Missing description of reltext's different behaviors (static & method on object)
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16645@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78000&edit=1 ID: 78000 Updated by: girgias@php.net Reported by: ssimo3 at lsuhsc dot edu -Summary: Description of reltext behavior +Summary: Missing description of reltext's different behaviors (static & method on object) -Status: Open +Status: Verified Type: Documentation Problem Package: Date/time related -Operating System: Windows 10 x64 +Operating System: -PHP Version: 7.3.5 +PHP Version: Irrelevant Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2019-05-10 14:22:02] ssimo3 at lsuhsc dot edu Description: ------------ --- From manual page: https://php.net/datetime.formats.relative --- 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: --------------- <?php 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78000&edit=1

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