wp_checkdate() WordPress Function

The wp_checkdate() function checks whether a given date is valid according to the Gregorian calendar. If the date is valid, the function returns true. Otherwise, it returns false.

wp_checkdate( int $month, int $day, int $year, string $source_date ) #

Test if the supplied date is valid for the Gregorian calendar.


Parameters

$month

(int)(Required)Month number.

$day

(int)(Required)Day number.

$year

(int)(Required)Year number.

$source_date

(string)(Required)The date to filter.


Top ↑

Return

(bool) True if valid date, false if not valid date.


Top ↑

Source

File: wp-includes/functions.php

function wp_checkdate( $month, $day, $year, $source_date ) {
	/**
	 * 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( $month, $day, $year ), $source_date );
}


Top ↑

Changelog

Changelog
VersionDescription
3.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More