Table of Contents

Syntax

bool checkdate(int $month, int $day, int $year)

(PHP 4, PHP 5)

$month Month number (1 - 12)
$day Day number (1 - 31)
$year Year number (e.g.: 2008)
RETURNS True or false indicating whether the values make a valid date

What it Does

Determines whether the numbers for month, day, and year can be combined to form a valid date. Use this to validate input when these three values are entered seperately.

Example

// check the date input on the form
if (!checkdate($_POST['month'], $_POST['day'], $_POST['year']))
    $err = 'Invalid date entered, please try again';