Home Tutorial Php Phpdate Check Date in PHP

 
 

Check Date in PHP
Posted on: August 25, 2009 at 12:00 AM
Advertisement
The PHP Checkdate function is used for validating the system date. It validate the Gregorian date. It returns 'True' if finds the specified date valid, otherwise it returns false.

Check Date in PHP

The Checkdate()

The PHP Checkdate function is used for validating the system date. It validate the Gregorian date. It returns 'True' if finds the specified date valid, otherwise it returns false.

Note: A Gregorian date is valid if 

  • the month is specified between 1 to 12 
  • the day is within the allowed number of days for the particular month
  • the year is between 1 and 32767 inclusive

Syntax
checkdate(month,day,year)

Parameter Description

month - month is essential parameter that specifies a month
day - Essential that specifies the day
year - year is also necessary that denotes the year. 

Example

<?php
var_dump(checkdate(07,31,2009));
var_dump(checkdate(2,29,2009));
var_dump(checkdate(2,29,2008));
?>

The output of the code above will be:
bool(true)
bool(false)
bool(true)

 

Advertisement

Related Tags for Check Date in PHP:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: August 25, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com