← All built-ins / checkdate()

checkdate()

checkdate(...$args): bool

Parameters

NameTypeDescription
$monthint1–12
$dayint1–31
$yearint4-digit year

Return value

true when the date exists (knows leap years).

Example

var_dump(checkdate(2, 29, 2024));
var_dump(checkdate(2, 29, 2023));
var_dump(checkdate(13, 1, 2024));
bool(true)
bool(false)
bool(false)

See also

mktime()date()