note 39783 deleted from function.date by derick
| From: | derick@php.net | Date: | Sat, 22 May 2004 13:53:43 +0000 |
| Subject: | note 39783 deleted from function.date by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69955@lists.php.net to get a copy of this message | ||
Note Submitter: Timothy Potter
----
I was looking for a way to minus a day or number of days of a given date and this is what I came up
with.
/*Date to minus a day off.*/
$datev = "20040210";
$newdate = date("Ymd",strtotime($datev) - (1 * 24 * 60 * 60));
echo $newdate;
/*
If you want to minus two days then it would be
$newdate = date("Ymd",strtotime($datev) - (2 * 24 * 60 * 60));
If you wanted to add a day then it would be
$newdate = date("Ymd",strtotime($datev) + (1 * 24 * 60 * 60));
*/