|
Posted by Martin Mouritzen on 11/15/06 20:35
On 15 Nov 2006 12:12:35 -0800, laredotornado@zipmail.com wrote:
>I'm using PHP 4.4.4. If I have a date of the form
>
> $curDate = date("Y-m-d");
>
>How do I create a variable $laterDate that is $curDate plus 6 months?
>I would like the result to be in the same format, Y-m-d.
Try this:
$curDate = date("Y-m-d");
$timestamp = strtotime($curDate);
$newDate = strtotime("+2 month",$timestamp);
print date("Y-m-d",$newDate);
--
best regards,
Martin Mouritzen.
http://www.siteloom.dk
Navigation:
[Reply to this message]
|