Code: Select all
<?php
function DaysInMonth( $month=0, $year=0 ) {
// Sanatise the passed vars
$month = intval($month);
$year = intval($year);
// If the year wasn't specified, then use current year
if (!$year) $year = date("Y");
// If the month wasn't specified, then use current month
if (!$month) $year = date("n");
// Return the days in the month
return date("j", mktime(0,0,0,$month,0,$year));
}
function IsLeapYear( $year=0 ) {
if ( date("j", mktime(0,0,0,3,0,$year)) == 29 ) {
return TRUE;
} else {
return FALSE;
}
}
?>