You almost never need to go down to getting epoch.
And in Rules DSL never force a value’s type, especially don’t force it to be a primitive unless absolutely necessary. It can add minutes to the amount of time it takes to parse the rules.
var Termin_Abfall = (CalDav_Date.state as DateTimeType).getZonedDateTime.getDayOfYear - now.getDateOfYear