Re: Re: how to test string to see if it is a date or time?
| From: | DomIntCom | Date: | Mon, 24 Mar 2003 19:36:51 +0000 |
| Subject: | Re: Re: how to test string to see if it is a date or time? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140876@lists.php.net to get a copy of this message | ||
thanks Erwin & Jason... I will work with these two, and see what I can come
up with.
"Erwin Kerk" <erwin@scoutingnederland.nl> wrote in message
news:3E7F449C.8030207@scoutingnederland.nl...
> Try this (as found on php.net)
>
> $str = 'Not Good';
> if (($timestamp = strtotime($str)) === -1) {
> echo "The string ($str) is bogus";
> } else {
> echo "$str == ". date('l dS of F Y h:i:s A',$timestamp);
> }
>
>
> Erwin Kerk
> Web Developer @ BliXem.nl
>
>
>
> Jason Wong wrote:
> > On Tuesday 25 March 2003 00:39, DomIntCom wrote:
> >
> >>can anybody help me out with this? I have figured out checkdate
finally,
> >>but still have nothing that will help me with time validation.
> >
> >
> > explode() on the time delimiter (probably colon)
> > check that hour is 1-12 (or 0-23)
> > check that minute is 0-59
> > check that second is 0-59
> >
>
>
> --
> ___ _
> | __|_ ___ __ _(_)_ _
> | _|| '_\ V V / | ' \ @blixem.nl (work)
> |___|_| \_/\_/|_|_||_|@scoutingnederland.nl (private)
>
>