Adding to a Date
| From: | Matt Cassarino | Date: | Sun, 07 Nov 2004 07:02:43 +0000 |
| Subject: | Adding to a Date | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-201402@lists.php.net to get a copy of this message | ||
Hi,
I am trying to add "x" days to the current date for a calendar program that I am writing.
"x" represents any integer from 1 to 7. So, for x=4, the program will get the current
date
2004-11-06
and add 4 days to it:
2004-11-10
I need it to account for the next month if I want to add 4 days to 2004-11-29, so the result would
be 2004-12-03, not 2004-11-33. It would need the same functionality in moving the year to
2005-01-02 when I add 3 days to 2004-12-30.
I hope that I've explained my objective clearly. I have tried getting the date using
$today = date("Y-m-d");
and then trying to add "x" to it, but it only adds "x" to the year, not the day
value. So how can I get PHP to add "x" to the day value? Any help would be awesome!
Thanks,
Matt
Matt Cassarino
206 484 4626
mc@mattcass.com
www.mattcass.com