Showing posts with label how to validate date in php form. Show all posts
Showing posts with label how to validate date in php form. Show all posts

Monday, April 1, 2019

How to check a string is valid format date in Mysql in php.


function isDateMySqlFormat($date)
{
    if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $date))
        return true;
    else
        return false;
}