note 35745 deleted from function.date by sniper
| From: | sniper@php.net | Date: | Sat, 11 Oct 2003 16:55:37 +0000 |
| Subject: | note 35745 deleted from function.date by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58305@lists.php.net to get a copy of this message | ||
Note Submitter: any mouse
----
Yes, there is a much easier way... convert your dates into UNIX timestamps, and let PHP do all the
work for you:
$date = "01/01/2003";
$timestamp = date("U",$date1);
$seven_days_ago = strtotime("-7 days",$timestamp);
$fourteen_days_from_now = strtotime("+14 days",$timestamp);
$seven_days_ago_str = date("m/d/Y",$seven_days_ago);
$fourteen_days_from_now_str = date("m/d/Y",$fourteen_days_from_now);