Validity of php verification time

Source: Internet
Author: User

Php verifies the validity of a date by using a built-in function, namely, the checkdate function. The following describes the definition and usage of the checkdate function.

Checkdate definition and usage

The checkdate () function verifies a greaguri date. If the specified value is valid, the function returns true; otherwise, false.

The date is valid in the following cases:

The month value ranges from 1 to 12.

The value of Day is within the range of days that a given month should have. A leap year has been taken into account.
 
Year between and includes 1 to 32767

Checkdate syntax

Checkdate (month, day, year)

Month is required. The specified month.

Day is required. Specified day.

Year is required. Specified year.

Example:

<? Phpvar_dump (checkdate (2000, 2003); var_dump (checkdate (2004,); var_dump (checkdate ));

The result will be output:

Bool (true)
Bool (false)
Bool (true)

Articles you may be interested in
  • How to verify the validity of date and time using javascript
  • PHP verifies the correctness and validity of the email address
  • Php summarizes the methods for obtaining the time interval. php displays the time interval of Forum posts.
  • PHP obtains the current time and timestamp.
  • Thinkphp automatic verification and automatic filling are invalid Solutions
  • Php extracts the birthday date from the ID card number and verifies whether it is a minor.
  • Php summarizes the N methods used to obtain the timestamp of today, tomorrow, and yesterday
  • Php obtains the start and end timestamps of today, yesterday, last week, and this month.

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.