From: [EMAIL PROTECTED]
Operating system: linux
PHP version: 4.2.3
PHP Bug Type: Date/time related
Bug description: strtotime fails when crossing year
/* function strftime produce wrong result with a timestamp close to the end
of
Year,the four digit year value is sometimes 1 year after (see
"30/12/2002")
and sometimes 1 year before (see "01/01/2005") the good one.
hope this help
*/
$dateTab=array();
$dateTab[0] = "Dec 29 2001";
$dateTab[1] = "Dec 30 2001";
$dateTab[2] = "Dec 31 2001"; wrong output with strftime
$dateTab[3] = "Jan 01 2002";
$dateTab[4] = "Dec 29 2002";
$dateTab[5] = "Dec 30 2002"; wrong output with strftime
$dateTab[6] = "Dec 31 2002"; wrong output with strftime
$dateTab[7] = "Jan 01 2003";
$dateTab[8] = "Dec 28 2003";
$dateTab[9] = "Dec 29 2003"; wrong output with strftime
$dateTab[10] = "Dec 30 2003"; wrong output with strftime
$dateTab[11] = "Dec 31 2003"; wrong output with strftime
$dateTab[12] = "Jan 01 2004";
$dateTab[13] = "Dec 28 2004";
$dateTab[14] = "Dec 29 2004";
$dateTab[15] = "Dec 30 2004";
$dateTab[16] = "Dec 31 2004";
$dateTab[17] = "Jan 01 2005"; wrong output with strftime
$dateTab[18] = "Jan 02 2005"; wrong output with strftime
$dateTab[19] = "Jan 03 2005";
$dateTab[20] = "Jan 04 2005";
$dateTab[21] = "Jan 05 2005";
foreach($dateTab as $currentDate) {
if (($timestamp = strtotime($currentDate)) === -1)
{
echo "The string ($currentDate) is bogus";
}
else
{
$result[0] = date('d/m/Y',$timestamp);
$result[1] = strftime("%d/%m/%G",$timestamp);
if($result[1] == $result[0]) {
echo "$currentDate == $result[0] == $result[1]<br>";
}
else
{
echo "$currentDate == $result[0] != <font
color=red>$result[1]</font><br>";
}
}
}
--
Edit bug report at http://bugs.php.net/?id=21212&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21212&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21212&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21212&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21212&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21212&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21212&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21212&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21212&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21212&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21212&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21212&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21212&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21212&r=isapi