View Issue Details

IDProjectCategoryView StatusLast Update
0002917phplist applicationAll Otherpublic08-07-05 16:06
Reportercrumrine 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.8.12 
Target VersionFixed 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.

http://dev.mysql.com/doc/mysql/en/upgrading-from-4-0.html

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.

Relationships

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

Activities

michiel

08-07-05 16:06

manager   ~0005575

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