<?PHP$days=Cal_days_in_month(Cal_gregorian, 4, 2011); Echo"Returns the number of days in 2011-4."$days." <br/> "; $days=Date(' t ',Strtotime("2011-4-1")); Echo"Returns the number of days in 2011-4."$days." <br/> "; $days=Date("T"); Echo"Number of days in the current month".$days." <br/> ";?>
Cal_days_in_month: Returns the number of days of a month in a calendar year
Parameter description:
Cal_days_in_month ($par 1, $par 2, $par 3);
$par 1: A calendar for calculation, PHP calendar constant
$par 2: Parameter $PAR1 Select a month in the calendar
$par 3: Select a year in the calendar
return value:
$par 1 days of the month of the selected calendar
PHP Calendar constants: The calendar extension contains functions that simplify conversion between different calendar formats.
In order for these functions to work, you must compile PHP through--enable-calendar. window, the support for calendar extensions has been integrated
The constants in the case are Cal_gregorian, which are predefined constants of PHP, like constants such as Php_os
Gregorian means: Gregorian calendar; Solar Calendar
Get the number of days in a month in PHP