How to use checkdate in PHP

This article describe about checkdate() Function in PHP.
  • 2132

checkdate() Function

This function return true if define date is valid otherwise return false.

Note: Date only valid if

  • Month is between 1 and 12.
  • Day is within allow number of date 1 to 31.
  • Year is between 1 and 32767.

Syntax

checkdate(month,day,year)

 

Parameter Description
month Required. Define the month.
day Required. Define the day
year Required. Define the year.

Example

<html>
<body>
<?php
var_dump(checkdate(11,30,2002));
var_dump(checkdate(2,29,2007));
var_dump(checkdate(2,29,2012));
?>
</body>
</html>

 

Output


pic1.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.