Date Validation

Date Validation

Date Validation

checkdate

checkdate
This function Validate a gregorian date/time.

Syntax:
——-
bool checkdate ( int month, int day, int year)

It returns TRUE if the date given is valid; otherwise

returns FALSE. Checks the validity of the date formed by the arguments.
A date is considered valid if:
the year is between 1 and 32767 inclusive

the month is between 1 and 12 inclusive

the Day is within the allowed number of days for the given month.

Leap years are also taken into consideration.

Example:
———-

echo checkdate(2,29,2007);
It returns FALSE.

Similarly given as
echo checkdate(2,29,2004);
It returns TRUE. because 2004 is leap year.

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.