PHP checkdate () to determine whether the date function

Source: Internet
Author: User
Tags php tutorial

Definitions and usage
The Checkdate () function verifies a Gregorian high date.

If the specified value is valid, the function returns True, otherwise it returns false.

The date is legal in the following cases:

Month between and including 1-12
The value of day is within the range of days that a given month should have, and a leap year has been taken into account.
Year is between and includes 1 to 32767
Grammar
Checkdate (month,day,year) parameter description
Month required. Set month.
Day required. Specified day.
Year required. Set year.
Example


<?php Tutorial
Var_dump (Checkdate (12,31,2000));
Var_dump (Checkdate (2,29,2003));
Var_dump (Checkdate (2,29,2004));
?>

Output:

BOOL (TRUE)
BOOL (FALSE)
BOOL (TRUE)

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.