Tests if the supplied date is valid for the Gregorian calendar.
Parameters
$monthintrequired- Month number.
$dayintrequired- Day number.
$yearintrequired- Year number.
$source_datestringrequired- The date to filter.
Source
function wp_checkdate( $month, $day, $year, $source_date ) {
$checkdate = false;
if ( is_numeric( $month ) && is_numeric( $day ) && is_numeric( $year ) ) {
$checkdate = checkdate( (int) $month, (int) $day, (int) $year );
}
/**
* Filters whether the given date is valid for the Gregorian calendar.
*
* @since 3.5.0
*
* @param bool $checkdate Whether the given date is valid.
* @param string $source_date Date to check.
*/
return apply_filters( 'wp_checkdate', $checkdate, $source_date );
}
Hooks
- apply_filters( ‘wp_checkdate’,
bool $checkdate ,string $source_date ) Filters whether the given date is valid for the Gregorian calendar.
Changelog
| Version | Description |
|---|---|
| 3.5.0 | Introduced. |
“checkdate” link, in description section (https://developer.wordpress.org/reference/functions/wp_checkdate/#see-also), is broken