You cannot simply subtract or add month VARs using mktime to obtain previous or next months as suggested in previous user comments (at least not with a DD > 28 anyway).
If the date is 03-31-2007, the following yeilds March as a previous month. Not what you wanted.
<?php
$dateMinusOneMonth = mktime(0, 0, 0, (3-1), 31, 2007 );
$lastmonth = date("n | F", $dateMinusOneMonth);
echo $lastmonth; ?>
mktime correctly gives you back the 3rd of March if you subtract 1 month from March 31 (there are only 28 days in Feb 07).
If you are just looking to do month and year arithmetic using mktime, you can use general days like 1 or 28 to do stuff like this:
<?php
$d_daysinmonth = date('t', mktime(0,0,0,$myMonth,1,$myYear)); $d_year = date('Y', mktime(0,0,0,$myMonth,1,$myYear)); $d_isleapyear = date('L', mktime(0,0,0,$myMonth,1,$myYear)); $d_firstdow = date('w', mktime(0,0,0,$myMonth,'1',$myYear)); $d_firstname = date('l', mktime(0,0,0,$myMonth,'1',$myYear)); $d_month = date('n', mktime(0,0,0,$myMonth,28,$myYear)); $d_monthname = date('F', mktime(0,0,0,$myMonth,28,$myYear)); $d_month_previous = date('n', mktime(0,0,0,($myMonth-1),28,$myYear)); $d_monthname_previous = date('F', mktime(0,0,0,($myMonth-1),28,$myYear)); $d_month_next = date('n', mktime(0,0,0,($myMonth+1),28,$myYear)); $d_monthname_next = date('F', mktime(0,0,0,($myMonth+1),28,$myYear)); $d_year_previous = date('Y', mktime(0,0,0,$myMonth,28,($myYear-1))); $d_year_next = date('Y', mktime(0,0,0,$myMonth,28,($myYear+1))); $d_weeksleft = (52 - $d_weekofyear); $d_daysinyear = $d_isleapyear ? 366 : 365; $d_daysleft = ($d_daysinyear - $d_dayofyear); ?>