I\'m allowing users to pick an hour from 00:00:00 to 23:00:00 and need to check if they submit the right format. Is there a regular expression or p
Has it to be a RegEx? You can easily use PHPs strtotime-function to validate dates and times (does also work without a date).
strtotime returns false (-1 prior to PHP 5.1) if the given time isn't valid. Don't forget to use the === operand therefore!
if (strtotime("12:13") === false) { echo("Wrong Time!"); } // Echos nothing
if (strtotime("19:45") === false) { echo("Wrong Time!"); } // Echos nothing
if (strtotime("17:62") === false) { echo("Wrong Time!"); } // Echos 'Wrong Time!'