Re: strtotime failure
| From: | David Robley | Date: | Tue, 07 May 2002 10:03:15 +0000 |
| Subject: | Re: strtotime failure | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96377@lists.php.net to get a copy of this message | ||
In article <E0C5888608A0D21182C00008C7096A67F39A54@mail.keh>,
j.koenig@keh-berlin.de says...
> Hallo,
>
> Why would strtotime fail (i.e. return a -1)? I check the type with gettype,
> which tells me that the argument I'm passing in is a string. I cast it to a
> string before passing it in, with the same results (returns a -1). The only
> thing that seems to do anything is to settype it to "string" before calling
> strtotime, which ends up with bizarre results.
>
> The arguments I'm passing in are, for example 11:00, 13:00, 14:30, etc, and
> are coming out of a database. Only SOME of this data results in a -1 when I
> call strtotime on it. Other records (the same numbers - 11:00, 13:00, etc.)
> come out fine.
>
> Could the data that's failing strtotime have been corrupted on data-entry?
> Why does is_string on this data tell me it's a string?
>
> --Jennifer Koenig
>
For a first guess, try using trim or chop on the data before feeding it to
strtotime, in case there are unexpected white spaces in the data.
--
David Robley
Temporary Kiwi!
Quod subigo farinam