Categories
PHP Tips & Tutorials

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

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';
}

By Yang Yang

Hello, I'm Yang. I build online businesses that please people. Want to join in and post some useful articles on Kavoir.com? Shoot me a message.