php checkdate() function syntax
Function:Verify a Gregorian date
Syntax: checkdate(month,day,year)
Parameters:
Parameters | 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. |
Description: Check if some dates are valid Gregorian dates
php checkdate() function example
<?php var_dump(checkdate(12,31,-220)); echo "<br>"; var_dump(checkdate(2,29,2003)); echo "<br>"; var_dump(checkdate(2,29,2004)); ?>
Click the "Run Instance" button to view the online instance
Output:
bool(false) bool(false) bool(true)