PHP cal_days_in_month() Function
In this chapter you will learn:
- Definition for PHP cal_days_in_month() Function
- Syntax for PHP cal_days_in_month() Function
- Parameter for PHP cal_days_in_month() Function
- Example - returns the number of days in a month for a specified year
Definition
The cal_days_in_month() function returns the number of days in a month for a specified year.
Syntax
PHP cal_days_in_month() Function has the following syntax.
cal_days_in_month(calendar,month,year);
Parameter
PHP cal_days_in_month() Function has the following parameters.
Parameter | Is Required | Description |
---|---|---|
calendar | Required. | Calendar to use. |
month | Required. | Selected Month |
year | Required. | Selected year |
Example
Returns the number of days in a month for a specified year
<?php
$d=cal_days_in_month(CAL_GREGORIAN,10,2012);
echo "There was $d days in October 2012";
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP cal_from_jd() Function
- Syntax for PHP cal_from_jd() Function
- Parameter for PHP cal_from_jd() Function
- Return value from PHP cal_from_jd() Function
- Example - converts a Julian day count into a date of a specified calendar
Home » PHP Tutorial » PHP Calendar Functions