|
|
|
@ -1062,15 +1062,25 @@ function format_date($date, $format=NULL, $convert=true)
|
|
|
|
|
if (empty($ts))
|
|
|
|
|
return '';
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$date = new DateTime("@".$ts);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception $e) {
|
|
|
|
|
return 'unknown';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// convert to the right timezone
|
|
|
|
|
$stz = date_default_timezone_get();
|
|
|
|
|
$tz = new DateTimeZone($convert ? $RCMAIL->config->get('timezone') : 'GMT');
|
|
|
|
|
date_default_timezone_set($tz->getName());
|
|
|
|
|
$tz = new DateTimeZone($convert ? $RCMAIL->config->get('timezones') : 'GMT');
|
|
|
|
|
$date->setTimezone($tz);
|
|
|
|
|
date_default_timezone_set($tz->getName());
|
|
|
|
|
|
|
|
|
|
$timestamp = $date->format('U');
|
|
|
|
|
}
|
|
|
|
|
catch (Exception $e) {
|
|
|
|
|
$timestamp = $ts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// define date format depending on current time
|
|
|
|
|
if (!$format) {
|
|
|
|
|