Web Analytics

PHP checkdate() Function

Date/Time FunctionPHP 4+

The checkdate() function validates a Gregorian date. It checks whether the given month, day, and year correspond to a valid 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 Value

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

Try It Online

Output
Click Run to execute your code

Related Functions

  • date() - Format a local time/date
  • mktime() - Get Unix timestamp for a date