Check out example codes for "regex to check date format php". It will help you in understanding the concepts better.

Code Example 1

if (preg_match("/\d{4}\-\d{2}-\d{2}/", $date)) {
    echo 'true';
} else {
    echo 'false';
}

Learn ReactJs, React Native from akashmittal.com