PHP: cal_days_in_month() function
Return the number of days in a month for a given year and calendar
The cal_days_in_month() function is used to get the number of days of a month for a given year and calendar.
Version:
(PHP 4 and above)
Syntax:
cal_days_in_month (calendar, month, year )
Parameters:
Name | Description | Required / Optional |
Type |
---|---|---|---|
calendar | Calendar to use for calculation. | Required | Integer |
month | Month in the selected calendar. | Required | Integer |
year | Year in the selected calendar. | Required | Integer |
Return value:
The length in days of the selected month in the specified calendar.
Value Type: Integer.
Example:
Sample Output:
No. of days in February 2020 : 29
View the example in the browser
See also
Previous: usort
Next: cal_from_jd