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

PHP check date function checkdate usage example_PHP tutorial

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

Examples of usage of checkdate function in php

This article mainly introduces the usage of checkdate function in php. The example analyzes the usage skills of checkdate function in php, which is of great practical value. , friends in need can refer to it

The example in this article describes the usage of PHP checkdate 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

?

1

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

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

Demo code

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

echo "2/29/1900";

checkdate (2, 29, 1900)?print " is Valid":print " is not valid";

echo "n";

echo "2/29/2000";

checkdate (2, 29, 2000)?print " is Valid":print " is not valid";

echo "n";

echo "2/29/2100";

checkdate (2, 29, 2100)?print " is Valid":print " is not valid";

echo "n";

echo "4/30/2008";

checkdate (4, 30, 2008)?print " is Valid":print " is not valid";

echo "n";

echo "4/31/2008";

checkdate (4, 31, 2008)?print " is Valid":print " is not valid";

echo "n";

?>

?

1

2

3

1

2

3

4

5

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

4 5

6

7 8

910 11 12 13 14 15
16
17
<๐ŸŽœ>echo "2/29/1900";<๐ŸŽœ> <๐ŸŽœ>checkdate (2, 29, 1900)?print " is Valid":print " is not valid";<๐ŸŽœ> <๐ŸŽœ>echo "n";<๐ŸŽœ> <๐ŸŽœ>echo "2/29/2000";<๐ŸŽœ> <๐ŸŽœ>checkdate (2, 29, 2000)?print " is Valid":print " is not valid";<๐ŸŽœ> <๐ŸŽœ>echo "n";<๐ŸŽœ> <๐ŸŽœ>echo "2/29/2100";<๐ŸŽœ> <๐ŸŽœ>checkdate (2, 29, 2100)?print " is Valid":print " is not valid";<๐ŸŽœ> <๐ŸŽœ>echo "n";<๐ŸŽœ> <๐ŸŽœ>echo "4/30/2008";<๐ŸŽœ> <๐ŸŽœ>checkdate (4, 30, 2008)?print " is Valid":print " is not valid";<๐ŸŽœ> <๐ŸŽœ>echo "n";<๐ŸŽœ> <๐ŸŽœ>echo "4/31/2008";<๐ŸŽœ> <๐ŸŽœ>checkdate (4, 31, 2008)?print " is Valid":print " is not valid";<๐ŸŽœ> <๐ŸŽœ>echo "n";<๐ŸŽœ> <๐ŸŽœ>?>
The output results are as follows ?
1 2 3 4 5 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. http://www.bkjia.com/PHPjc/970750.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/970750.htmlTechArticlephp check date function checkdate usage example This article mainly introduces the php check date function checkdate usage, and the example analyzes php The usage skills of checkdate function are very practical...
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