Home  >  Article  >  Backend Development  >  In PHP, translate the following: checkdate() function

In PHP, translate the following: checkdate() function

WBOY
WBOYforward
2023-09-17 23:01:07723browse

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

checkdate() function verifies the Gregorian calendar date. Returns TRUE if the date is valid, FALSE otherwise.

Syntax

checkdate(month, day, year)

Parameters

  • Month - Specify the month as a number between 1 and 12

  • day - Specify the date as a number between 1 and 31

  • year - Specify the year as A number between 1 and 32767

Returns

The checkdate() function returns TRUE if the date is valid, otherwise it returns FALSE.

Example

Here are the examples-

Live Demonstration

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

Output

bool(true)

Example

Let’s see Another example -

Live demo

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

Output

bool(true)

The above is the detailed content of In PHP, translate the following: checkdate() function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete