Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP checkdate() Function

PHP checkdate() Function

PHP Date/Time PHP Date/Time Reference Manual

Example

Check whether some dates are valid Gregorian dates:

"; var_dump(checkdate(2,29,2003)); echo "
"; var_dump(checkdate(2,29,2004)); ?>

Run Example »


Definition and Usage

The checkdate() function validates a Gregorian date.

Syntax

checkdate(

month,day,year);

Parameters Description
month Required. A number from 1 to 12 specifying the month.
day Required. A number from 1 to 31 specifying the day.
year Required. A number from 1 to 32767 specifying the year.

Technical Details

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

PHP Date/Time PHP Date/Time Reference Manual