diff --git a/include/class.format.php b/include/class.format.php
index cfb2df4f072abbf38fb2f71d628a19ef243e61a8..dda04156936c4046bc1d677470257cb46062f2ea 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -522,7 +522,9 @@ class Format {
 
         $format = self::getStrftimeFormat($format);
         // Properly convert to user local time
-        $time = DateTime::createFromFormat('U', $timestamp, new DateTimeZone('UTC'));
+        if (!($time = DateTime::createFromFormat('U', $timestamp, new DateTimeZone('UTC'))))
+           return '';
+
         $offset = $user_timezone->getOffset($time);
         $timestamp = $time->getTimestamp() + $offset;
         return strftime($format ?: $strftimeFallback, $timestamp);