首页 > 文章列表 > 在PHP中,translate the following:checkdate()函数

在PHP中,translate the following:checkdate()函数

399 2023-09-11

checkdate() 函数验证公历日期。如果日期有效,则返回 TRUE,否则返回 FALSE。

语法

checkdate(month, day, year)

参数

  • 月份 - 将月份指定为 1 到 12 之间的数字

  • < li>

    day - 将日期指定为 1 到 31 之间的数字

  • year - 指定年份作为 1 到 32767 之间的数字

返回

如果日期有效,则 checkdate() 函数返回 TRUE,否则返回 FALSE。

示例

以下是示例 -

 现场演示

<?php
   var_dump(checkdate(10,29,2018));
?>

输出

bool(true)

示例

让我们看另一个示例 -

 现场演示

<?php
   $month = 9;
   $day = 30; $year = 2018;
   var_dump(checkdate($month, $day, $year));
?>

输出

bool(true)