Doc #63360 [Opn->Csd]: Changelog may be incorrect

From: Date: Mon, 05 Nov 2012 11:35:20 +0000
Subject: Doc #63360 [Opn->Csd]: Changelog may be incorrect
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9057@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63360&edit=1 ID: 63360 User updated by: wachsmuth at cominto dot de Reported by: wachsmuth at cominto dot de Summary: Changelog may be incorrect -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: windows PHP Version: Irrelevant Block user comment: N Private report: N New Comment: okay thank you Previous Comments: ------------------------------------------------------------------------ [2012-10-26 17:51:29] hanskrentel at yahoo dot de Thank you for taking the time to create a bug report. Actually you might have misunderstood something here. The documentation of 'now' is pretty clear about that: --------- http://www.php.net/manual/en/datetime.formats.relative.php 'now' Now - this is simply ignored --------- For your understanding imagine you have got a DateTime object. It is the context in which you call the modify() function. Different to time() which has the system's time as a hidden dependency, the DateTime object has it's own time value as it's "dependency". 'Now' therefore is the now of that object instance, its own time value. That is why you do not see any change if you modify a DateTime by 'now'. It's not your systems now, but the now of the object. ------------------------------------------------------------------------ [2012-10-25 11:20:48] wachsmuth at cominto dot de Description: ------------ --- From manual page: http://www.php.net/datetime.modify --- Hello, the Changelog says with PHP 5.3.6 "Absolute date/time statements now take effect" I run following script with PHP 5.3.8. The first two times and the last time it is correct. But modify('now') does not set the date to "now" like setTimeStamp(time()). The documentation here is misleading Test script: --------------- $d = new DateTime(); $d->setTimeStamp(strtotime('2012-10-25')); assertThis(25, $d); $d->modify('-1 day'); assertThis(24, $d); $d->modify('now'); assertThis(25, $d); $d->setTimeStamp(time()); assertThis(25, $d); function assertThis($expected, $actual) { print 'expected ' . $expected . ' - ' . $actual->format('d') . " actual\n"; } Expected result: ---------------- expected 25 - 25 actual expected 24 - 24 actual expected 25 - 25 actual expected 25 - 25 actual Actual result: -------------- expected 25 - 25 actual expected 24 - 24 actual expected 25 - 24 actual expected 25 - 25 actual ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63360&edit=1

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