PHP - How to check a value is proper date format or not?

by barkkathulla 2014-02-27 16:22:33

To check given value is proper date format or not...

if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$_GET['date']))
{
echo "proper date is obtained";
}else{
echo "given value is not a valid date";
}
1001
like
0
dislike
0
mail
flag

You must LOGIN to add comments