RE: [PHP] Adding one month to a given date
| From: | Vail, Warren | Date: | Mon, 02 Feb 2004 22:31:26 +0000 |
| Subject: | RE: [PHP] Adding one month to a given date | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176631@lists.php.net to get a copy of this message | ||
I've found the following works best for me, takes into consideration
leapyears and daylight savings time, etc.
$datetime = date("Y-m-d H:i:s",strtotime($inputdatetime." + 1 month"));
http://www.php.net/manual/en/ref.datetime.php
Warren Vail
-----Original Message-----
From: merlin [mailto:news.groups@web.de]
Sent: Monday, February 02, 2004 2:24 PM
To: php-general@lists.php.net
Subject: [PHP] Adding one month to a given date
Hi there,
I am trying to add one month to a given date. Somehow I am lost
inbetween mktime, date and unix timestamps ;-(
Can anybody give me a hint on that?
The date format I do have is: 2003-10-19
Guess this does not work:
$ptm = '2003-10-19';
$ptm = 1 + mktime('YmdHis',$ptm);
Thanx for any help,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php