Monday, 26 August 2013

PHP Function cal_days_in_month()

Syntax

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

Definition and Usage

This function will return the number of days in the month of year for the specified calendar.

Paramters

ParameterDescription
calendarRequired. Calendar to use for calculation.
monthRequired. Month in the selected calendar
yearRequired. Year in the selected calendar

Return Value

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

Example

Try out following example:
<?php
$num = cal_days_in_month(CAL_GREGORIAN, 8, 2003);
echo "There was $num days in August 2003";
?> 
This will produce following result:
There was 31 days in August 2003


No comments:

Post a Comment