[thelist] PHP mkdate() question

CDitty mail at redhotsweeps.com
Mon Jul 16 17:13:05 CDT 2001


I am trying to get the number of days in the current month.  This is some 
code that I have been using for a few months.

$smonth = date("n");
$syear = date("Y");
$days = date("d", mktime(0, 0, 0, $smonth + 1, 1, $syear) - 1); // Number 
of days in month

For some reason, if I do not add the +1 to $smonth, it gets the date 
wrong.  Also, any reason for the -1?  Like I said, I don't remember where I 
got this, but it has been working fine.  Just don't understand why.

Anyone understand why?

Chris





More information about the thelist mailing list