checkdate in PHP

Syntax of checkdate

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

Returns true if the month, date, and year as given in the parameters are valid (Gregorian), and false if not. A date is considered valid if the year falls between 1 and 32,767 inclusive, the month is between 1 and 12 inclusive, and the day is within the number of days the specified month has (including leap years)

Example of checkdate

var_dump(checkdate(12, 31, 2000));
var_dump(checkdate(2, 29, 2001));

Leave a Comment