There are various ways of validating dates in PHP or MySql, sometimes however you may just need to check if a string is a valid MySQL format date, outside of a form validator. This simple utility function will accept a string returning true if it’s a valid MySQL date, using a regular expression.

 

Snippet

LEAVE A COMMENT

Notify of
avatar
wpDiscuz