PHP checkdate() Function
Example
Check if 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)); ?>
Definition and Usage
The checkdate() function is used to validate the Gregorian date.
Syntax
checkdate(month,day,year);
Parameter | Description |
---|---|
month | Required. Specifies the month, a numeric value from 1 to 12. |
day | Required. Specifies the day, a numeric value from 1 to 31. |
year | Required. Specifies the year, a numeric value from 1 to 32767. |
Technical Details
Return Value: | Returns TRUE if the date is valid, otherwise returns FALSE. |
---|---|
PHP Version: | 4.0+ |