"Lester Caine" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Ashley Sheridan wrote:
>>>> I'll translate
>>>>
>>>> In PHP4, strtotime works fine
>>>>
>>>> in PHP5 strtotime gives a result of 19700101 when the data entered was
>>>> strtotime("20080950")
>>>>
>>>>
>>> What does "work fine" mean? "20080950" isn't normal, so what is the
>>> expected result?
>
>> Well, for starts Micah is right, your date string will be interpreted as
>> the 50th of September, 2008, which isn't valid and defaults to the time
>> represented by the timestamp 0. If you want to turn 8-digit number
>> strings into timestamps, make sure of two things:
>>
>> 1.It's actually a string and not a number
>> 2.The string is in the format yyyymmdd
>>
>> The strings can be a variety of formats, all found at
>> http://www.gnu.org/software/shishi/manual/html_node/Date-input-formats.html
>> which is a link available on the strtotime manual page.
>
> I seem to remember a previous discussion about this 'bug' but I can't
> track the notes. Is it not the case that you can simply add days or months
> to the 'number' and then use strtotime to output the 'normalised' date. So
> adding 30 to 20th Sept would return 20th October. This very useful feature
> was corrected as a bug in the rewrite of Date in PHP5.1?
> Reason for looking for the notes was to remember how one has to do it now
> ....
>
> --
> Lester Caine - G8HFL
Thanks everybody for your answer. Yes, this is a very useful feature to add
days in a date.
My version of PHP is 5.2.0....
Fx GILLES
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php