Home >Backend Development >PHP Tutorial >PHP check date function checkdate usage example, checkdate example_PHP tutorial

PHP check date function checkdate usage example, checkdate example_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:02:06969browse

php check date function checkdate usage example, checkdate example

This article describes the use of php check date function checkdate. Share it with everyone for your reference. The specific analysis is as follows:

You can use the checkdate function in PHP to verify the correctness of the date.

Grammar

integer checkdate (int %Month, int $Day, int $Year);

Demo code

<&#63;PHP
echo "2/29/1900";
checkdate (2, 29, 1900)&#63;print " is Valid":print " is not valid";
echo "\n";
echo "2/29/2000";
checkdate (2, 29, 2000)&#63;print " is Valid":print " is not valid";
echo "\n";
echo "2/29/2100";
checkdate (2, 29, 2100)&#63;print " is Valid":print " is not valid";
echo "\n";
echo "4/30/2008";
checkdate (4, 30, 2008)&#63;print " is Valid":print " is not valid";
echo "\n";
echo "4/31/2008";
checkdate (4, 31, 2008)&#63;print " is Valid":print " is not valid";
echo "\n";
&#63;>

The output results are as follows

2/29/1900 is not valid
2/29/2000 is Valid
2/29/2100 is not valid
4/30/2008 is Valid
4/31/2008 is not valid

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/970863.htmlTechArticlephp check date function checkdate usage example, checkdate example This article describes the use of php check date function checkdate. Share it with everyone for your reference. The specific analysis is as follows: In php...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn