adding dates in php
<p>I have the following statement. Either i get the date from the querystring or i get todays date. </p>

<p>I then need to get the current, previous, next month. </p>

<p>I think i'm going wrong by using "strtotime"</p>

<pre><code>$selecteddate = ($_GET ['s'] == "" )
    ? getdate()
    : strtotime ($_GET ['s']) ;


    $previousMonth = strtotime(date("Y-m-d", $selecteddate) . " +1 month");

    $previousMonthName = $previousMonth[month];
    print $previousMonthName;
    $month = $selecteddate[month];
</code></pre>

<p>/* edit */</p>

<pre><code>$selecteddate = ($_GET ['s'] == "" )
? getdate()
: strtotime ($_GET ['s']) ;

$previousMonth = strtotime(" -1 month", $selecteddate);
$nextMonth = strtotime(" +1 month", $selecteddate);


$previousMonthName = date("F",$previousMonth); //Jan
$nextMonthName = date("F",$nextMonth); // Jan
$month = $selecteddate[month];  // Aug
</code></pre>
