Re: Re: Time Processing

From: Date: Sun, 14 Oct 2001 15:49:44 +0000
Subject: Re: Re: Time Processing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-71034@lists.php.net to get a copy of this message
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.

« previous php.general (#71034) next »