Looking for the correct preg_match (or other solution) to validate a string to go in mysql time datatype. The format is xxx:xx:xx and between ranges '-838:59:59' to '838:59:59'
Also in mind that "7:53:48", "23:59", "145:19:59", and "-16:24:33" are all valid inputs but "930:00:00", 128:61:61" and "63:59" are all invalid.
I've got this far from a normal time preg_match
preg_match("/([0-9]):([0-5][0-9]):([0-5][0-9])$/", $time)
But this only validates the minutes and seconds properly. Any ideas !?
Also note that I understand that time mysql datatype also accepts values without the colons, but that's been handled separately already ;)
EDIT
I'm really sorry guys, missunderstood mysql doc. 70:59 is actually valid input, it will be translated to 70:59:00