Check for Valid Date with PHP

I stumbled on this handy function this morning when putting together a form that required a valid date (example: 02/30/2011 would not be valid because there are not 30 days in February). Very simple and useful!

checkdate ( int $month , int $day , int $year )

Checks the validity of the date formed by the arguments. A date is considered valid if each parameter is properly defined.

Documentation: http://php.net/manual/en/function.checkdate.php

About the Author...

Jennifer Zelazny

My name is Jennifer Zelazny and this site is a collection of my random thoughts and opinions. I am Penn Stater, WordPress developer, and a modern day explorer. I love exploring data, trends, and things that make the world a better place and sharing them here.

Leave a Reply

Your email address will not be published.
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.