diff --git a/include/class_templateHandling.inc b/include/class_templateHandling.inc
index 6752459c402ab58f7f59b02967b99d8e592c1095..2655ba9b105532ff595b1142b4b23611dc4228da 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]));
   }