Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

checkdate()

Example

Verify whether multiple dates are valid according to the Gregorian calendar.

<?php
var_dump(checkdate(12,31,-400));
echo “<br>”;
var_dump(checkdate(2,29,2003));
echo “<br>”;
var_dump(checkdate(2,29,2004));
?>

Definition and Usage

The checkdate() function is used to determine if a date is valid in the Gregorian calendar.

Syntax

checkdate(month, day, year)

Parameter Values

Parameter

Description

month

Required. Specifies the month as a numerical value ranging from 1 to 12.

day

Required. Indicates the day as a numerical value between 1 and 31.

year

Required. Represents the year as a numerical value between 1 and 32767.

Technical Details

 

Return Value:

Returns TRUE if the date is valid; otherwise, returns FALSE.

PHP Version:

4.0+