PHP: Validate Date – Check if A Given Date, Month and Year Combination is Valid or Legal

by Yang Yang on June 2, 2009

Share This Article:
Subscribe to Kavoir: blog feed

The simples PHP function that does the job I can think of is checkdate():

if (checkdate(2, 28, 1999)) { // Feb. 28th, 1999
	echo 'valid';
} else {
	echo 'invalid';
}
Share This Article:
Subscribe to Kavoir: blog feed

You should also read:

Leave a Comment

Previous post:

Next post: