PHP Calendar

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : cal_days_in_month() function

Description

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 :

  1. $day_count=cal_days_in_month(CAL_GREGORIAN,02,2020);  

  2. echo  ' No of days in February 2020 : ' .$day_count;  

  3. ?>  

Output :

No. of days in February 2020 : 29