mktime() bug? result strtotime() fail in PHP
Marcus Grando
marcus at corp.grupos.com.br
Thu Feb 17 03:53:26 PST 2005
Hi,
Peter Jeremy wrote:
>>Also FreeBSD 5.3-STABLE?
>
> I don't have a 5.3-STABLE system to confirm but if it doesn't return -1
> it is wrong.
>
Then, it's wrong.
> What timestamp should it return? 2004-11-02 00:00:00 doesn't exist for
> you, therefore there is no possible value for seconds since epoch that
> will convert to this time. The manpage states:
> until tm_mon and tm_year are determined. The mktime() function returns
> the specified calendar time; if the calendar time cannot be represented,
> it returns -1;
> Since 2004-11-02 00:00:00 cannot be represented, then it should return -1.
>
> Maybe you should explain why having mktime() correctly report an error is
> a problem for you.
>
Because of that:
<?php
putenv("TZ=America/Sao_Paulo");
echo $i = strtotime("2004-11-01"), "\n";
echo strtotime("+1 day", $i), "\n";
?>
--
Marcus Grando
Grupos Internet S/A
marcus(at)corp.grupos.com.br
More information about the freebsd-stable
mailing list