note 101983 added to function.date-sub
| From: | JonathanPoissant at osu1 dot php dot net | Date: | Fri, 21 Jan 2011 15:26:02 +0000 |
| Subject: | note 101983 added to function.date-sub | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175965@lists.php.net to get a copy of this message | ||
You cannot replace date_sub('2000-01-20') by DateTime::sub('2000-01-20') because
DateTime::sub is not static. You have to create the DateTime object first.
Example:
$dateA = date_sub('2000-01-20', date_interval_create_from_date_string('10
days'));
will be replace by
$dateB = new DateTime('2000-01-20');
$dateA = $dateB->sub(date_interval_create_from_date_string('10 days'));
----
Server IP: 69.147.83.197
Probable Submitter: 64.119.210.250
----
Manual Page -- http://www.php.net/manual/en/function.date-sub.php
Edit -- https://master.php.net/note/edit/101983
Del: integrated -- https://master.php.net/note/delete/101983/integrated
Del: useless -- https://master.php.net/note/delete/101983/useless
Del: bad code -- https://master.php.net/note/delete/101983/bad+code
Del: spam -- https://master.php.net/note/delete/101983/spam
Del: non-english -- https://master.php.net/note/delete/101983/non-english
Del: in docs -- https://master.php.net/note/delete/101983/in+docs
Del: other reasons-- https://master.php.net/note/delete/101983
Reject -- https://master.php.net/note/reject/101983
Search -- https://master.php.net/manage/user-notes.php