Quote:
Originally posted by Naughty
I have to get the last month is simple 1,2,3 format, but I cannot get to it:/
PHP Code:
$lastmonth = date("n")-1;
This would work, however, NOT if you want to get the rusult 12, like this month the last months'number is 12, not 0.
|
$lastmonth = date("m") -1;
if ($lastmonth == 0) {$lastmonth = 12;}
There is a better way to do it using a mktime formula.
http://www.php.net/date