I have the following statement. Either i get the date from the querystring or i get todays date.
I then need to get the current, previous, next month.
I think i'm going wrong by using "strtotime"
$selecteddate = ($_GET ['s'] == "" )
? getdate()
: strtotime ($_GET ['s']) ;
$previousMonth = strtotime(date("Y-m-d", $selecteddate) . " +1 month");
$previousMonthName = $previousMonth[month];
print $previousMonthName;
$month = $selecteddate[month];
/* edit */
$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
$selecteddatewill either hold an array (returned fromgetdate()) or an integer (returned fromstrtotime()). The later calls tostrtotime()will not be happy at all if passed the array.