0

Background

I have a simple apex function which returns a date time formatted using a time zone:

public String getFormattedDatetime() {

    TimeZone tz = UserInfo.getTimeZone();

    return dateTimeValue.format(dateTimeFormat, tz.toString());
}

This function is used inside a Visualforce email template, and the email is generated by a Site Guest User.

The Site Guest User had it's Time Zone set to GMT

But recently, the clock changed in the UK, and we are now on BST

So all the times in the emails being generated wrong.

Question

  1. Is there a way to ensure Salesforce always issues emails using the correct Time Zone, without having to remember to update the Time Zone on the Site Guest User profile?

1 Answer 1

6

If the correct time zone to use when formatting all Site Guest User e-mails is British time, then choose British Summer Time (Europe/London) on that user account always. That should give you +00:00 in the winter and +01:00 in the summer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .