0

Between the UI on direct records automatically adjusting to my time zone and not knowing default behavior in visualforce pages, I'm having trouble wrapping my head around what the user experience might be.

I have a Case with a datetime field set as, for example, 6/21/2019 9AM

It is represented in the visualforce template as follows

<apex:outputText rendered="{!NOT(ISNULL(relatedTo.SurgeryDate_Time__c))}" value="{0,date,yyyy/MM/dd 'at' HH:mm:ss z}">
                          <apex:param value="{!relatedTo.SurgeryDate_Time__c-(1/3)}" />
                          </apex:outputText><br/>

This was mostly existing in the org before I came along, so I didn't write this initially, I just added the "value=..etc" for the formatting.

Anyway, I send a test email with the Case and I see it exactly as I do on the record in the UI. My question...

  1. Let's say the user is someone in a different time zone. Will their version of the email have a different time labeled in their time zone? If not, how might I do this?
1

The email template is processed in the context of a User (the user who performed the action that triggered the sending of the email) and all date/time values are rendered in that contextual user's time zone. The recipient for an email doesn't affect the time zone/locale applied. (This is a significant short-coming of the Salesforce emailing infrastructure.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.