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