View Single Post
Old 01-18-2003, 06:47 AM  
notjoe
Confirmed User
 
Industry Role:
Join Date: May 2002
Location: Toronto, Canada
Posts: 5,599
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

Last edited by notjoe; 01-18-2003 at 06:49 AM..
notjoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote