Email Template V1 date format timezone issues - Certification Reassignment

Thanks @gmilunich , this was a much-needed head start.
I did work on the code a little, as i was seeing some anomalies with the resulting date. Like it was subtracting double the time zones from what i actually needed.

My resulting code is this as I am needing EST/EDT.

#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($ESTimeZone = $TimeZoneClass.getTimeZone("US/Eastern"))
#set($SimplifiedDate = $spTools.getClass().forName("java.text.SimpleDateFormat"))
#set($pattern = $SimplifiedDate.newInstance()) $pattern.applyPattern("MM/dd/yyyy h:mm a z")
$pattern.setTimeZone($ESTimeZone)
#set($rectifiedTimeZoneDisplay = $pattern.format($NewCalendarInstance.getTime())) ${rectifiedTimeZoneDisplay}

and when i encapsulte from the first line to just before the ${rectifiedTimeZoneDisplay} in html p’s I am able to keep it as a one liner and not see all the additional lines the template adds

i also used this list to get the needed time zones (What are the Java TimeZone IDs?)

2 Likes