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:
<?php
$day_count=cal_days_in_month(CAL_GREGORIAN,02,2020);
echo ' No of days in February 2020 : ' .$day_count;
?>
Sample Output:
No. of days in February 2020 : 29
View the example in the browser
See also
Previous: usort
Next: cal_from_jd
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/php/function-reference/cal_days_in_month.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics