diff --git a/include/class_templateHandling.inc b/include/class_templateHandling.inc
index 731aca9e0bbca9be41284a57b5f8e53c0a404abc..54c5f8ec7528cb2b9591fddcb289621f5d744421 100644
--- a/include/class_templateHandling.inc
+++ b/include/class_templateHandling.inc
@@ -364,6 +364,10 @@ class templateHandling
       $args[] = 'd.m.Y';
     }
     $dateObject = new DateTime($args[0], new DateTimeZone('UTC'));
+    if ($args[1] == 'epoch') {
+      /* Special handling for shadowExpire: days since epoch */
+      return array(floor($dateObject->format('U') / 86400));
+    }
     return array($dateObject->format($args[1]));
   }