Php checks the usage of the date function checkdate instance, and the checkdate instance _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Php checks the usage instance of the date function checkdate and the checkdate instance. Php checks the checkdate usage instance of the date function. the checkdate instance in this document describes the php checkdate usage of the date function. Share it with you for your reference. The specific analysis is as follows: php checks the checkdate usage instance of the date function in php and the checkdate instance.

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

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

Demo code

<?PHPecho "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 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.

The following example describes how to use the php Date Check function checkdate. Share it with you for your reference. The specific analysis is as follows: php...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.