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:[EMAIL PROTECTED]
Sent: Monday, February 02, 2004 2:24 PM
To: [EMAIL PROTECTED]
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to