Php checks the usage of the date function checkdate instance

Source: Internet
Author: User

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.

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.