Verify whether multiple dates are valid according to the Gregorian calendar.
<?php var_dump(checkdate(12,31,-400)); echo “<br>”; var_dump(checkdate(2,29,2003)); echo “<br>”; var_dump(checkdate(2,29,2004)); ?> |
The checkdate() function is used to determine if a date is valid in the Gregorian calendar.
checkdate(month, day, year) |
Parameter |
Description |
month |
Required. Specifies the month as a numerical value ranging from 1 to 12. |
day |
Required. Indicates the day as a numerical value between 1 and 31. |
year |
Required. Represents the year as a numerical value between 1 and 32767. |
Return Value: |
Returns TRUE if the date is valid; otherwise, returns FALSE. |
PHP Version: |
4.0+ |