Thursday 8 January 2015

cal_days_in_month - PHP



cal_days_in_month — Return the number of days in a month for a given year and calendar
Description
int cal_days_in_month ( int $calendar , int $month , int $year )

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

Calendar to use for calculation month

Month in the selected calendar year

Year in the selected calendar
Return Values

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

<?php
$d=cal_days_in_month(CAL_GREGORIAN,2,1965);
echo "There was $d days in February 1965.<br>";

$d=cal_days_in_month(CAL_GREGORIAN,2,2004);
echo "There was $d days in February 2004.";
?>

O/P:

There was 28 days in February 1965.
There was 29 days in February 2004. 

0 or CAL_GREGORIAN - Gregorian Calendar
1 or CAL_JULIAN - Julian Calendar
2 or CAL_JEWISH - Jewish Calendar
3 or CAL_FRENCH - French Revolutionary Calendar
 

0 comments:

Post a Comment