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