How many days in a month
by Guna[ Edit ] 2012-07-23 18:48:22
The following function lets you create no days for a given
month. for example,
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);
}
echo days_in_month(date('n'),date('Y'));