I want to validate a time input (like 10:30 am, 02:30 pm) using preg_match()
I use this,
$pattern = "/([1-12]):([0-5])([0-9])( )(am|pm|AM|PM)/";
if(preg_match($pattern,$time)){
return true;
}
But when i give an input like 10:30 pmxxxx
it will not validated.
I dont know whether the method is correct or not. Help please.