PHP check date function checkdate usage example, checkdate example_PHP tutorial

WBOY
Release: 2016-07-13 10:02:06
Original
958 people have browsed it

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);
Copy after login

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;>
Copy after login

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
Copy after login

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...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template