|
|
Tutorials » Php »
|
Topic |
What is a Check Date Function?
|
|
Explanation |
|
The "checkdate()" function is used to check the validity of a given date.
Syntax:
bool checkdate (int $month, int $day, int $year)
In the above syntax, value of the month should be between 1 to 12, year from 1 to 32767, leapyear is also considered.
Example:
<?php
var_dump(checkdate(12, 30, 2000));
echo "<br>";
var_dump(checkdate(2, 29, 2001));
?>
Result:
bool(true)
bool(false)
In the above example, the checkdate() function checks two dates, to return boolean values either true or false. The second date is for a leap year, which has only 28 days to return false
Note: (PHP 4, PHP 5)
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|