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 about how to use the php checkdate function, see the example in this article. 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
Integer checkdate (int % Month, int $ Day, int $ Year );
Demo code
<? PHPecho "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:
2/29/1900 is not valid2/29/2000 is Valid2/29/2100 is not valid4/30/2008 is Valid4/31/2008 is not valid
I hope this article will help you with php programming.