检查多个日期是否是有效的公历日期:
<?php
var_dump(checkdate(12,31,-400));
echo "<br>";
var_dump(checkdate(2,29,2003));
echo "<br>";
var_dump(checkdate(2,29,2004));
?>
亲自试一试 »
checkdate() 函数用于验证公历日期。
checkdate(
month, day, year)
Parameter | Description |
---|---|
month | Required. Specifies the month as a number between 1 and 12 |
day | Required. Specifies the day as a number between 1 and 31 |
year | Required. Specifies the year as a number between 1 and 32767 |
返回值: | 如果日期有效,则为 TRUE。否则为假 |
---|---|
PHP 版本: | 4.0+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!