I have used the below PHP function to get the previous month,
$currmonth = date(\'m\', strtotime(\'-1 month\'));
It was working fine and I
If you just need to get the month number of previous month, the following should suffice.
$m = idate("m") - 1; // wrap to previous year if ($m < 1) { $m = 12 - abs($m) % 12; }
This works with arbitrary number of subtracted months.