note 39783 added to function.date
| From: | TimothyPotter at rn2 dot php dot net | Date: | Tue, 10 Feb 2004 15:28:45 +0000 |
| Subject: | note 39783 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64960@lists.php.net to get a copy of this message | ||
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));
*/
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39783
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39783&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39783&report=yes
Search -- http://master.php.net/manage/user-notes.php