Mar 9, 2011

PHP number of days of a month

If you want to obtain number of days of a month, in PHP, you can use cal_days_in_month function:


int cal_days_in_month ( int $calendar , int $month , int $year )







So, here we have one example of usage of this function:


$num = cal_days_in_month(CAL_GREGORIAN, 8, 2003); // 31
    echo "There was $num days in August 2003";
?>