note 126960 added to datetime.modify
| From: | hienle at main dot php dot net | Date: | Mon, 28 Mar 2022 03:49:46 +0000 |
| Subject: | note 126960 added to datetime.modify | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217774@lists.php.net to get a copy of this message | ||
Keep in mind that method chaining is only available from PHP 5.3, so with older versions, this will
not work:
<?php
$exp_date = new DateTime();
echo $exp_date->modify("-10 month")->format("Y-m-d");
?>
This will work:
<?php
$exp_date = new DateTime();
$exp_date->modify("-10 month");
echo $exp_date->format("Y-m-d");
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 182.171.74.66)
----
Manual Page -- https://php.net/manual/en/datetime.modify.php
Edit -- https://main.php.net/note/edit/126960
Del: integrated -- https://main.php.net/note/delete/126960/integrated
Del: useless -- https://main.php.net/note/delete/126960/useless
Del: bad code -- https://main.php.net/note/delete/126960/bad+code
Del: spam -- https://main.php.net/note/delete/126960/spam
Del: non-english -- https://main.php.net/note/delete/126960/non-english
Del: in docs -- https://main.php.net/note/delete/126960/in+docs
Del: other reasons-- https://main.php.net/note/delete/126960
Reject -- https://main.php.net/note/reject/126960
Search -- https://main.php.net/manage/user-notes.php