NYCPHP Meetup

NYPHP.org

[nycphp-talk] Date problems running PHP on IRIX

Daniel Porcher danporcher at earthlink.net
Mon Dec 8 17:43:34 EST 2003


I thought the 1969 date limitiation was just a Windows issue, but I have
just run into the same problem on a client's web site hosted by Rapidsite.
Rapidsite is hosting a PHP CGI implementation on Apache on IRIX on a SGI
server.  

Here's the test code:

echo formatdate("1970-01-30");
echo "<br>";
echo formatdate("1969-01-30");
echo "<br>";
echo formatdate("1959-01-30");
echo "<br>";


function formatdate($szdate)
{
	if  (isset($szdate) && ($szdate != "0000-00-00"))
	{
		$date = strtotime($szdate);
		$arrdate = getdate($date);
		$rtn = checkdate($arrdate['mon'], $arrdate['mday'] ,
$arrdate['year']);
		if($rtn)
		{
			return ($arrdate['mon'] . "/" . $arrdate['mday'] .
"/" . $arrdate['year']);
		}else{
			return $szdate;
		}
	}
	return "";
	
}

The results I get on Rapidsite is:

1/30/1970
12/31/1969
12/31/1969

I ran the same code on another host and got the correct results

1/30/1970
1/30/1969
1/30/1959

Has anybody seen this problem before?  Is there a work around?

Thanks,

Dan

Daniel Porcher
President
Watershed Web Design

Phone: (609) 466-0266
Fax:   (609) 466-2701





More information about the talk mailing list