hi Claus,
haaah. ....i didnt see that ,
The DateTime class, here, might help (quoting) : Each component of date (e.g. year) is internally stored as 64-bit number so all imaginable dates (including negative years) are supported.
But note that :
* It's only exists in PHP >= 5.2
* And several methods only exist in PHP >= 5.3
So : beware of which methods you're using, if you're developping on PHP 5.3 and want your software to be compatible with PHP 5.2
Another solution (especially, if using Zend Framework in your application) would be the Zend_Date component (quoting) :
Although PHP 5.2 docs state, "The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT," Zend_Date supports a nearly unlimited range, with the help of the BCMath extension
another is strtotime() limitations , what i use myStrtomtime($string) can handle uptill 1909 . here it is
-
<?php
-
function myStrtotime($strInput)
-
{
-
$iVal = -1;
-
for ($i=1900; $i<=1969; $i++)
-
{
-
// Check for this year string in date
-
$strYear = (string)$i;
-
if (!(strpos($strInput, $strYear)===false))
-
{
-
$replYear = $strYear;
-
$yearSkew = 1970 - $i;
-
$strInput = str_replace($strYear, '1970', $strInput);
-
}
-
}
-
$iVal = strtotime($strInput);
-
if ($yearSkew> 0)
-
{
-
$numSecs = (60 * 60 * 24 * 365 * $yearSkew);
-
$iVal = $iVal - $numSecs;
-
$numLeapYears = 0; // determine number of leap years in period
-
for ($j=$replYear; $j<=1969; $j++)
-
{
-
$thisYear = $j;
-
$isLeapYear = false;
-
// Is div by 4?
-
if (($thisYear % 4) == 0)
-
{
-
$isLeapYear = true;
-
}
-
// Is div by 100?
-
if (($thisYear % 100) == 0)
-
{
-
$isLeapYear = false;
-
}
-
// Is div by 1000?
-
if (($thisYear % 1000) == 0)
-
{
-
$isLeapYear = true;
-
}
-
if ($isLeapYear == true)
-
{
-
$numLeapYears++;
-
}
-
}
-
$iVal = $iVal - (60 * 60 * 24 * $numLeapYears);
-
}
-
return $iVal;
-
}
-
echo date("m-d-Y",myStrtotime("1909-01-01")) ;
-
?>
-
hope it could help you some how
regards,
Omer Aslam