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
- 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 theSite Guest User
profile?