here's a thought: -----------------
// using strtotime() you can turn your date into a unixtimestamp. e.g.
$unixTimeStamp = strtotime('2003-10-19');
// using getdate($unixTimeStamp) you can get the consituent parts of the // date. e.g.
$dateParts = getdate($unixTimeStamp);
// then create a new unixtimestamp with mktime() e.g.
$newUnixTimeStamp = mktime($dateParts['hours'], $dateParts['minutes'], $dateParts['seconds'], $dateParts['mon'] + 1, $dateParts['mday'], $dateParts['year']);
// now you need to format the unixtimestamp so its humanly readable e.g.
echo strftime('%Y-%m-%d', $newUnixTimeStamp);
----
tip: mktime() is a great tool for date calculations! check the comments on PHP site (page for the mktime() function) for tips on this.
hope it helps (the above may contain typos!)
rgds,
jochem
merlin wrote:
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