PHP checkdate()Functions

PHP Date/TimePHP Date/Time Reference Manual

Examples

Check whether some dates are valid Gregorian dates:

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

Run Example »

Definition and Usage

The checkdate() function is used to validate a Gregorian date.

Syntax

checkdate(month,day,year);

Parameter Description
month Required. A number from 1 to 12 that specifies the month.
day Required. A number from 1 to 31 that specifies the day.
year Required. A number from 1 to 32767 that specifies the year.

Technical Details

Return Value: Returns TRUE if the date is valid, otherwise FALSE.
PHP Version: 4.0+


PHP Date/TimePHP Date/Time Reference Manual Other Extensions