Example of using php to check the date function checkdate

Source: Internet
Author: User
Example of using php to check the date function checkdate
Syntax

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

Demo code

  1. Echo "2/29/1900 ";
  2. Checkdate (2, 29,190 0 )? Print "is Valid": print "is not valid ";
  3. Echo "\ n ";
  4. Echo "2/29/2000 ";
  5. Checkdate (2, 29,200 0 )? Print "is Valid": print "is not valid ";
  6. Echo "\ n ";
  7. Echo "2/29/2100 ";
  8. Checkdate (2, 29,210 0 )? Print "is Valid": print "is not valid ";
  9. Echo "\ n ";
  10. Echo "4/30/2008 ";
  11. Checkdate (4, 30,200 8 )? Print "is Valid": print "is not valid ";
  12. Echo "\ n ";
  13. Echo "4/31/2008 ";
  14. Checkdate (4, 31,200 8 )? Print "is Valid": print "is not valid ";
  15. Echo "\ n ";
  16. ?>


The output result is 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

Php, checkdate

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.