We are creating a Visualforce email template to be sent when certain Events are saved/edited to meet criteria. The VF Template is related To Event/Contact:
<messaging:emailTemplate subject="Appointment Reminder" recipientType="Contact" relatedToType="Event">
I am working on outputting the Date, and Start - End time of the Appointment (Event), in EST, to send to our customers, like this:
Event Name
05/08/2017
05:00 PM - 6:00 PM EST
Currently I am using the following formatting to output the date and date/time values to the template:
<apex:outputText value="{0,date,MM/dd/yyyy}">
<apex:param value="{!relatedTo.ActivityDate}" />
</apex:outputText><br />
<apex:outputText value="{0,date,hh:mm:ss a}">
<apex:param value="{!relatedTo.StartDateTime}" />
</apex:outputText>
-
<apex:outputText value="{0,date,hh:mm:ss a}">
<apex:param value="{!relatedTo.EndDateTime}" />
</apex:outputText><br />
However, most of us probably already know that Salesforce stores datetime values in GMT. My appointment is booked at 5-6PM EST, but the GMT conversion makes it 9-10PM GMT, so the above code is resulting in this output:
I would like to output the times in Eastern, regardless of who the template is being sent to, since all of our customers know that we book in eastern time. I could possibly hard code this with something like {!relatedTo.StartDateTime-(4/24)}
but that will only work until we change times during Daylight savings spring forward/fall back times.
Question: I'm trying to avoid making a component and a custom controller for the purposes of outputting just 2 date fields, so figured I'd come to the best Salesforce community I know to see if there were any trade secrets I could use or things I missed that would allow me to force the output into EST - specifically in a way that accounts for daylight savings and doesn't require a component and controller. Is this possible?