RE: [PHP] adding days to a given date
| From: | Harish | Date: | Wed, 31 Mar 2004 09:52:50 +0000 |
| Subject: | RE: [PHP] adding days to a given date | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181916@lists.php.net to get a copy of this message | ||
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:news.groups@web.de]
Sent: Wednesday, March 31, 2004 2:31 PM
To: php-general@lists.php.net
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