|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-04-20 23:33 UTC] dtajchreber@php.net
-Status: Open
+Status: Verified
[2011-04-20 23:33 UTC] dtajchreber@php.net
[2011-04-20 23:36 UTC] derick@php.net
-Status: Verified
+Status: Assigned
-Assigned To:
+Assigned To: derick
[2011-04-20 23:37 UTC] dtajchreber@php.net
-Status: Assigned
+Status: Closed
[2011-04-20 23:37 UTC] dtajchreber@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 09:00:02 2025 UTC |
Description: ------------ DateTime::sub() does not work on objects created by a date string. If the object is created by timestamp it works. Test script: --------------- <?php $dt = new DateTime('first day of this month'); // correct output: "2011-04-01 22:41:17" var_dump($dt); // wrong output: "2011-04-01 22:41:17" var_dump($dt->sub(new DateInterval('P2D'))); // correct output: "2011-03-30 20:41:17" var_dump(date_create('@' . $dt->getTimestamp())->sub(new DateInterval('P2D')));