Latest web development tutorials

PHP cal_days_in_month () function

PHP Calendar Reference Manual PHP Calendar Reference Manual

Examples

For a given calendar year and to get the number of days in a month:

<?php
$d=cal_days_in_month(CAL_GREGORIAN,10,2005);
echo "There was $d days in October 2005";
?>

Running instance »

Definition and Usage

cal_days_in_month () function for the specified year and calendar, returns the number of days in a month.

grammar

cal_days_in_month( calendar,month,year);

参数 描述
calendar 必需。规定要使用的历法。请参阅 PHP Calendar 常量
month 必需。规定选定历法中的月。
year 必需。规定选定历法中的年。

technical details

return value: For a given year and calendar, returns the number of days in the month selected.
PHP version: 4.1+


PHP Calendar Reference Manual PHP Calendar Reference Manual