Re: [PHP] Re: Time Processing From: A. R. M. (amojahed <email protected>)
Date: 10/14/01

Hi,

|> function CheckTime($t) {
|> /* Checks the value of a 24-hour formatted time to be correct.
|> Returns 0 if bad time format, 1 otherwise.
|> */
|> return ( ereg("[012][0-9]:[0-5][0-9](:[0-5][0-9])?", $t) );
|> }
|
|You'd need to adjust this, because by your regex, 29:00:00 would be a
|valid time.

Absolutely right. Thanks James.

This should work then:

   return ( ereg("([01][0-9]|2[0-4]):[0-5][0-9](:[0-5][0-9])?", $t) );

Cheers.

|> function CheckTime($t) {
|> /* Checks the value of a 24-hour formatted time to be correct.
|> Returns 0 if bad time format, 1 otherwise.
|> */
|> return ( ereg("[012][0-9]:[0-5][0-9](:[0-5][0-9])?", $t) );
|> }
|
|You'd need to adjust this, because by your regex, 29:00:00 would be a valid
|time.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>