Skip to content

Commit

Permalink
Resolved issue 0000900: format_date function doesn't work when time i…
Browse files Browse the repository at this point in the history
…s omitted with 'mysql_datetime' type

Continue correction of grum

git-svn-id: http://piwigo.org/svn/trunk@2856 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
rub committed Nov 9, 2008
1 parent 1ddabfb commit 2a804c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/category_default.inc.php
Expand Up @@ -117,15 +117,15 @@
'FILE_PATH' => $row['path'],
'FILE_POSTED' => format_date($row['date_available'], 'mysql_datetime'),
'FILE_CREATED' => (empty($row['date_creation'])) ?
'-': format_date($row['date_creation'], 'us'),
'-': format_date($row['date_creation'], 'mysql_date'),
'FILE_DESC' => (empty($row['comment'])) ? '-' : $row['comment'],
'FILE_AUTHOR' => (empty($row['author'])) ? '-' : $row['author'],
'FILE_HIT' => $row['hit'],
'FILE_SIZE' => (empty($row['filesize'])) ? '-' : $row['filesize'],
'FILE_WIDTH' => (empty($row['width'])) ? '-' : $row['width'],
'FILE_HEIGHT' => (empty($row['height'])) ? '-' : $row['height'],
'FILE_METADATE' => (empty($row['date_metadata_update'])) ?
'-': format_date($row['date_metadata_update'], 'us'),
'-': format_date($row['date_metadata_update'], 'mysql_date'),
'FILE_RATE' => (empty($row['rate'])) ? '-' : $row['rate'],
'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ?
true:false, /* lack of include/functions_picture.inc.php */
Expand Down
8 changes: 8 additions & 0 deletions include/functions.inc.php
Expand Up @@ -601,6 +601,14 @@ function format_date($date, $type = 'us', $show_time = false)
array($out[1],$out[2],$out[3],$out[4],$out[5],$out[6]);
break;
}
case 'mysql_date' :
{
preg_match('/^(\d{4})-(\d{2})-(\d{2})$/',
$date, $out);
list($year,$month,$day) =
array($out[1],$out[2],$out[3]);
break;
}
}
$formated_date = '';
// before 1970, Microsoft Windows can't mktime
Expand Down

0 comments on commit 2a804c8

Please sign in to comment.