Re: Re: Time Processing
| From: | Papp Gyozo | Date: | Tue, 16 Oct 2001 13:17:57 +0000 |
| Subject: | Re: Re: Time Processing | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71203@lists.php.net to get a copy of this message | ||
and what about strftime()?
http://www.php.net/manual/en/function.strftime.php
----- Original Message -----
From: "A. R. M." <amojahed@uwo.ca>
To: <php-general@lists.php.net>
Sent: Sunday, October 14, 2001 5:49 PM
Subject: Re: [PHP] Re: Time Processing
> 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@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>