Validity of PHP verification time

Source: Internet
Author: User
Tags date bool current time time interval

PHP Validation date validity has built-in function, namely Checkdate function, below share the definition and usage of checkdate function.

Checkdate 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

Checkdate syntax

Checkdate (Month,day,year)

Month required. Set month.

Day required. Specified day.

Year required. Set year.

Examples of use are as follows:

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

The result will be output:

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

Articles that you may be interested in

    • How JavaScript validates date-time validity
    • PHP Verify that the mailbox is correct and effective
    • PHP to get time interval method Summary, PHP display forum post time interval method Daquan
    • thinkphp automatic verification and automatic filling invalid solution
    • PHP Gets the current time, time stamp method large sum
    • PHP extracts the birthday date in the ID number and the function to verify that it is a minor
    • PHP gets the method for each month over a period of time, returning an array of these months
    • How PHP Gets the start time stamp and end time stamp for today, yesterday, last week, 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.