Php checks the usage of the date function checkdate instance
This article mainly introduces the usage of the date function checkdate in php, and analyzes the usage skills of the checkdate function in php, which is very useful. For more information, see
This example describes how to use the php date check function checkdate. Share it with you for your reference. The specific analysis is as follows:
In php, you can use the checkdate function to verify the correctness of the date.
Syntax
?
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 |
<? PHP Echo "2/29/1900 "; Checkdate (2, 29,190 0 )? Print "is Valid": print "is not valid "; Echo "\ n "; Echo "2/29/2000 "; Checkdate (2, 29,200 0 )? Print "is Valid": print "is not valid "; Echo "\ n "; Echo "2/29/2100 "; Checkdate (2, 29,210 0 )? Print "is Valid": print "is not valid "; Echo "\ n "; Echo "4/30/2008 "; Checkdate (4, 30,200 8 )? Print "is Valid": print "is not valid "; Echo "\ n "; Echo "4/31/2008 "; Checkdate (4, 31,200 8 )? Print "is Valid": print "is not valid "; Echo "\ n "; ?> |
The output result is 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 help you with php programming.