HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

checkdate

Description

The checkdate of Date / Time for PHP validate a Gregorian date.

Syntax

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

Parameters

month

The month is between 1 and 12 inclusive.

day

The day is within the allowed number of days for the given month. Leap years are taken into consideration.

year

The year is between 1 and 32767 inclusive.

Return

Returns true if the date given is valid; otherwise returns false.

Examples

1 · valid

<?

$month = 2;
$day = 29;
$year = 2000;

$return = checkdate($month, $day, $year);

var_export($return);
true

2 · invalid

<?

$month = 2;
$day = 29;
$year = 2001;

$return = checkdate($month, $day, $year);

var_export($return);
false