Simple Days in Month function
by Guna[ Edit ] 2011-03-11 14:51:43
Hi,
Simply pass the month,years in numbers it will return return number of days in that month.
function days_in_month($month, $year) {
//calculate number of days in a month
//$month: numeric month (integers 1-12)
//$year: numeric year (any integer)
return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
}