Merlin
Richard Hawkes wrote:
You'll want to do something like this:
$timeStamp = strtotime("2004-04-29");
$timeStamp += 24 * 60 * 60 * 7; // (add 7 days)
$newDate = date("Y-m-d", $timeStamp);
The 'strtotime' function converts all sorts of standard dates to the Unix Epoch seconds (seconds since 1/1/1970). You then just add the required seconds!
Cheers Richard
-----Original Message----- From: Merlin [mailto:[EMAIL PROTECTED] Sent: 31 March 2004 10:01 To: [EMAIL PROTECTED] Subject: [PHP] adding days to a given date
Hi there,
I am trying to add days to a given day, but somehow I am lost in all the time functions. This should be a standard function. Maybe someone has a good hint for me?
This is the given day: 2004-04-29 I would like to add 2 days to it. So php should anyhow now how many days April has to result in this: 2004-04-30 2004-05-1
Thank you for any helpful hint,
merlin
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php