Bug #17190 Updated: Date() gives error for date prior to 1-1-1970

From: Date: Fri, 24 May 2002 18:59:06 +0000
Subject: Bug #17190 Updated: Date() gives error for date prior to 1-1-1970
References: 1  Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-8422@lists.php.net to get a copy of this message
ID: 17190 Updated by: derick@php.net Reported By: mfconstable@pacbell.net -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Windows NT 4.0 PHP Version: 4.2.0 New Comment: This bug has been fixed in CVS. You can grab a snapshot of the CVS version at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2002-05-22 13:29:43] tom@php.net Yep, the exact output is Invalid date range Warning: unexpected error in date() in D:\Test\t.php on line 8 ------------------------------------------------------------------------ [2002-05-22 06:52:35] darkelder@php.net Please, someone check on Windows the routine I wrote. Maybe on Windows date() return error if time is -1. ------------------------------------------------------------------------ [2002-05-22 06:50:46] darkelder@php.net I'm using PHP 4.1.2 and no error on date() as got on: <?PHP error_reporting(E_ALL); $time = strtotime("1850-10-10"); if ($time == -1) { print "Invalid date range\n"; } print date("d-m-Y",$time); ?> The only error is that date will allways show the date of time = -1 on invalid range (< 1970 OR > 2038). Is only a code bug. You should verify if $time is -1. ------------------------------------------------------------------------ [2002-05-14 04:08:10] sitnikov@infonet.ee Look also www.php.net/strtotime ------------------------------------------------------------------------ [2002-05-14 03:53:09] mfischer@php.net Reopening as a documentation problem. I threw a quick glance on the php.net/date page last night and I couldn't find it there. If it's nere, it needs to be outlined better, or well, documented at all. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/17190 -- Edit this bug report at http://bugs.php.net/?id=17190&edit=1

« previous php.bugs (#8422) next »