#20048 [Com]: mktime() returns -1 for dates < 1970
| From: | chuck at horizonlinux dot org | Date: | Sat, 27 Sep 2003 00:52:17 +0000 |
| Subject: | #20048 [Com]: mktime() returns -1 for dates < 1970 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-48162@lists.php.net to get a copy of this message | ||
ID: 20048
Comment by: chuck at horizonlinux dot org
Reported By: jamie at hometownsports dot ca
Status: Wont fix
Bug Type: Unknown/Other Function
Operating System: RedHat Linux 7.3
PHP Version: 4.2.2
New Comment:
havn't tested it on rh 7.3 but will do monday
but for sure on rh 9 it's not working
with default rh php package, it returns -1
and with my own compiled php it returns -3000 something
can't remember the exact number off hand but
we all get the point, it's not working :(
will be looking forward to see a fix here :)
Previous Comments:
------------------------------------------------------------------------
[2003-02-27 00:55:54] jlim at natsoft dot com dot my
As a workaround, you can use the adodb_time library, that uses PHP code
to calculate negative timestamps.
http://php.weblogs.com/adodb_date_time_library
------------------------------------------------------------------------
[2002-10-23 15:18:40] hholzgra@php.net
unix timestamp behavior for negative values is undefined
it *may* map to pre-1970 dates but there is no guarantee
whatsoever
------------------------------------------------------------------------
[2002-10-23 14:26:42] jamie at hometownsports dot ca
glibc-2.2.5-34 and greater has been changed to return -1 for dates <
1970. This used to work. The problem exists with RedHat 7.3 and 8.0
echo (mktime(0, 0, 0, 1, 1, 1960)); // prints -1
------------------------------------------------------------------------
[2002-10-23 14:23:48] jamie at hometownsports dot ca
glibc-2.2.5-34 and greater has been changed to return -1 for dates <
1970. This used to work. The problem exists with RedHat 7.3 and 8.0
echo (mktime(0, 0, 0, 1, 1, 1960)); // prints -1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20048&edit=1