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.


  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?

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.

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.