Latest News: (loading..)
Issue Information
-
#000537
-
0 - None Assigned
-
New
-
2.3.3
-
-
Issue Confirmations
-
Yes (0)No (0)
function tep_date_long will quit working after the year 2038
Posted by wdepot on 31 October 2012 - 11:38 PM
This is probably low priority since we have a few years left until 2038 but eventually this will need to be addressed. While the tep_date_short function has a fix for years after 2037 the tep_date_long function does not and will produce some odd results once the date exceeds the capabilities of the mktime function. However I've discovered that the function can be fixed using the built in PHP Julian date functions which work for dates through the year 9999.
Simply replace at the end of the function:
return strftime(DATE_FORMAT_LONG, mktime($hour,$minute,$second,$month,$day,$year));
with the following:
$JD = gregoriantojd($month, $day, $year);
$mname = jdmonthname($JD, 1);
$wdname = jddayofweek($JD, 1);
$day = sprintf('%02d' , $day);
$year = sprintf('%04d' , $year);
$x = DATE_FORMAT_LONG;
return preg_replace(array('/\%A/', '/\%d/', '/\%B/', '/\%Y/'), array($wdname, $day, $mname, $year), $x);
Simply replace at the end of the function:
return strftime(DATE_FORMAT_LONG, mktime($hour,$minute,$second,$month,$day,$year));
with the following:
$JD = gregoriantojd($month, $day, $year);
$mname = jdmonthname($JD, 1);
$wdname = jddayofweek($JD, 1);
$day = sprintf('%02d' , $day);
$year = sprintf('%04d' , $year);
$x = DATE_FORMAT_LONG;
return preg_replace(array('/\%A/', '/\%d/', '/\%B/', '/\%Y/'), array($wdname, $day, $mname, $year), $x);










