Email Template V1 date format timezone issues - Certification Reassignment

@gmilunich - okay…brace yourself!

From testing I realized that, the ‘Test Email’ feature supports v2 variables hence when you send an email via ‘Test Email’ it works fine but when the certification is triggered, it just displays the variable.

As for you to change time zones, use below:

#set($CalendarClass = $spTools.getClass().forName("java.util.Calendar"))
#set($TimeZoneClass = $spTools.getClass().forName("java.util.TimeZone"))
#set($NewCalendarInstance = $CalendarClass.getInstance()) $NewCalendarInstance.setTime($certification.expiration)
#set($GMTTimeZone = $TimeZoneClass.getTimeZone("GMT"))
#set($NZTimeZone = $TimeZoneClass.getTimeZone("Pacific/Auckland"))
#set($offsetCalculation = $NZTimeZone.getRawOffset() - $GMTTimeZone.getRawOffset())
$NewCalendarInstance.add($CalendarClass.getField("MILLISECOND").getInt(null), $offsetCalculation)
#set($CertExpireDate = $spTools.formatDate($NewCalendarInstance.getTime(), "dd-MM-yyyy HH:mm:ss a"))
${CertExpireDate}

All you are doing here is using the offset value from the TimeZone class in java to add/subtract from the GMT offset value which will be ‘0’ and hence giving you the updated time in NZST.

1 Like