Latest web development tutorials

PHP checkdate () function

PHP Date / Time PHP Date / Time Reference Manual

Examples

Check some dates are valid Gregorian date:

<?php
var_dump(checkdate(12,31,-400));
echo "<br>";
var_dump(checkdate(2,29,2003));
echo "<br>";
var_dump(checkdate(2,29,2004));
?>

Running instance »

Definition and Usage

checkdate () function is used to verify the Gregorian date.

grammar

checkdate( month,day,year);

参数 描述
month 必需。一个从 1 到 12 的数字,规定月。
day 必需。一个从 1 到 31 的数字,规定日。
year 必需。一个从 1 到 32767 的数字,规定年。

technical details

return value: If the date is valid returns TRUE, otherwise it returns FALSE.
PHP version: 4.0+


PHP Date / Time PHP Date / Time Reference Manual