The time function available in PHP can be used for your requirement/

$two_days_later = date("Y-m-d",mktime(0,0,0,$month,$day+2,$year));

where $month, $day and $year are the respective parts of the given day

$year=2004
$month=04
$day=29

You can specify the number of days to be "+/-" in the mktime function, like its 
specified above.
You can also "+/-" the months and year if necessary.


regards
Harish

-----Original Message-----
From: Merlin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 31, 2004 2:31 PM
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


Reply via email to