View Issue Details

IDProjectCategoryView StatusLast Update
0002917phpList 3 applicationGeneralpublic08-07-05 16:06
Reportercrumrine Assigned To 
Status resolvedResolutionfixed 
Product Version2.8.12 
Fixed in Version2.9.5 
Summary0002917: MySQL 4.1+ TIMESTAMP SQL Change
DescriptionWith the release of MySQL 4.1, timestamps no longer return as a timestamp (I wonder what they were thinking). They now return as a datetime in a query.

Look for "Incompatible change: TIMESTAMP"

This was really obvious in the admin/userhistory.php as the event timestamps parsed incorrectly.

I made a quick change to my code - added a check for a timestamp (which should be numeric) and parse a timestamp if it's not - could probably just pass that through though as it's really close.

function niceDateTime($datetime) {
    if (is_numeric($datetime)) {
        $year = substr($datetime,0,4);
        $month = substr($datetime,4,2);
        $day = substr($datetime,6,2);
        $hr = substr($datetime,8,2);
        $min = substr($datetime,10,2);
    } else {
        $year = substr($datetime,0,4);
        $month = substr($datetime,5,2);
        $day = substr($datetime,8,2);
        $hr = substr($datetime,11,2);
        $min = substr($datetime,14,2);
    return date("D M j G:i T Y",mktime($hr,$min,0,$month,$day,$year));

I did notice this function also existed in user.php. I haven't looked beyond this for timestamp parsing functions.
TagsNo tags attached.


related to 0002457 resolvedmichiel PHPList v2.9.5 release 
has duplicate 0003116 resolvedmichiel niceDateTime in userhistory.php incorrect. 



08-07-05 16:06

administrator   ~0005575

resolved by requesting the formatting from Mysql instead using date_format(time,"%e %b %Y %T")