I want to get next and previous month from given date. this is my code.
$month = '2011-01-20';
$prevMOnth = funP($month); $nextMonth = funN($month);
what is best solution to do that.
I want to get next and previous month from given date. this is my code.
$month = '2011-01-20';
$prevMOnth = funP($month); $nextMonth = funN($month);
what is best solution to do that.
$next_month_ts = strtotime('2011-01-20 +1 month');
$prev_month_ts = strtotime('2011-01-20 -1 month');
$next_month = date('Y-m-d', $next_month_ts);
$prev_month = date('Y-m-d', $prev_month_ts);