cal_days_in_month

Return the number of days in a month for a given year and calendar

Syntax

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

Parameters

calendar

Calendar to use for calculation

NumberConstantDescription
0CAL_GREGORIANGregorian Calendar
1CAL_JULIANJulian Calendar
2CAL_JEWISHJewish Calendar
3CAL_FRENCHFrench Revolutionary Calendar
month

Month in the selected calendar

year

Year in the selected calendar

Return

The length in days of the selected month in the given calendar

Examples

calendar | CAL_GREGORIAN

<?

$calendar = CAL_GREGORIAN;
$month = 1;
$year = 1;

$return = cal_days_in_month($calendar, $month, $year);

echo $return;

?>
31

calendar | CAL_JULIAN

<?

$calendar = CAL_JULIAN;
$month = 1;
$year = 1;

$return = cal_days_in_month($calendar, $month, $year);

echo $return;

?>
31

calendar | CAL_JEWISH

<?

$calendar = CAL_JEWISH;
$month = 1;
$year = 1;

$return = cal_days_in_month($calendar, $month, $year);

echo $return;

?>
30

calendar | CAL_FRENCH

<?

$calendar = CAL_FRENCH;
$month = 1;
$year = 1;

$return = cal_days_in_month($calendar, $month, $year);

echo $return;

?>
30

PHP

HomeMenu