We are facing an issue with BST and GMT time zone. We have a community portal and the org timezone and all the Users timezone are set as BST. Part of our functionality is to book an event and we redirect our users (on the community portal) to a third party system which displays available slots in BST.

Once the user provides their detail and confirms their booking, this third party system then POSTS back into salesforce and create a record of our custom Event booking object.

The Event Booking object has a custom field Booking_Start_Time__c and Booking_End_Time__c. The third party system, for an event booked for 9:00 AM to 9:30 AM, send

{"Booking_Start_Time__c" : "08:00:00.000Z",
 "Booking_End_Time__c" : "08:30:00.000Z"}

Essentially, they are sending the GMT time (-1 for the actual booking time) for booking start and end times. The issue is Salesforce displays this as is i.e. "08:00" and "08:30" on the Event Booking detail page even though the User's timezone is set as BST

I am unable to explain this behaviour and would appreciate if someone can shed some light on this.

Adding some screenshots

  1. User time zone : enter image description here
  2. Event booking display page : enter image description here
  3. Same record when accessed in workbench : enter image description here

1 Answer 1


All DateTimes in Salesforce are stored as GMT/UTC so that they can easily be shifted based on a user's timezone (a necessity in any organization where users are logging in from multiple time zones). So if you see GMT in the database, that's as designed. If the time isn't being shown properly to the end user, consider using a component that displays a DateTime based on a user's locale such as formatted-date-time in a LWC, or lightning:formattedDateTime in an Aura component. You can also render a DateTime in a specific timezone using the DateTime.format() method in Apex or a combination of date(), which returns the current date in the context of the running user, and time() which returns the current time in the context of the running user.

DateTime myDateTime = DateTime.newInstance(1999, 1, 1, 1, 0, 0);
System.debug('My User format (taking into account Locale and TimeZone): ' + myDateTime.format());
System.debug('Perth: ' + myDateTime.format('MM/dd/yyyy hh:mm:ss a z', 'Australia/Perth'));
System.debug('Seoul: ' + myDateTime.format('MM/dd/yyyy hh:mm:ss a z', 'Asia/Seoul'));
System.debug('Los Angeles: ' + myDateTime.format('MM/dd/yyyy hh:mm:ss a z', 'America/Los_Angeles'));

This outputs (I ran this as a user with an American locale and an EDT timezone):

My User format (taking into account Locale and TimeZone): 1/1/1999 1:00 AM
Perth: 01/01/1999 02:00:00 PM AWST
Seoul: 01/01/1999 03:00:00 PM KST
Los Angeles: 12/31/1998 10:00:00 PM PST


I think I see the problem and it's my own inexperience with "Time" custom fields (they're relatively new) as opposed to "DateTime" custom fields. Time fields don't react to a user's location. That's because "11:00", "14:00", "12:50 AM" would all be valid inputs to a Time field and - without a date component - it's not possible to know if Daylight Savings Time is in effect or how far to shift a time based on where you are in the world. See some of the notes from Salesforce regarding the Time field or this Trailblazers post. Relevant answer quoted below from Amnon Kruvi:

Since the question is about Time fields, and not DateTime, the answer is no - they are not converted to a timezone. The reason for this is that timezones are date-dependent (thanks to daylight saving time). Hence, without an anchor to the date, it is not possible to convert a time between timezones.

If you know you will only ever need to support BST timezone (and Daylight Savings isn't a factor) and no one in the org will ever be another timezone, it's probably safe to set the timezone for the org to BST and use a Time field. However, if you need to support multiple timezones I would switch to using a DateTime field instead to accurately capture times.

  • Hi @nbrown, i am just curious why salesforce isnt showing the BST time on the objects detail page within salesforce. I can implement the lightning:formattedDateTime to fix this but based on Salesforce docs, i shouldnt have to Commented Sep 9, 2020 at 13:55
  • The object page should reflect the timezone of the user automatically. Can you double-check the timezone for the problem user?
    – nbrown
    Commented Sep 9, 2020 at 15:35
  • Hi @nbrown, have attached screenshots of timezone, the booking time on detail page and what it shows in the backend. Commented Sep 9, 2020 at 16:50
  • Sorry, I missed the distinction between Time and DateTime in your post. Time is a relatively new field type that I've never used. I've updated my answer accordingly.
    – nbrown
    Commented Sep 9, 2020 at 17:32
  • What you say makes perfect sense. I just tested it with a date time field and it works. However, I still think Salesforce is doing some kind of timezone conversion for time fields. If I send time field without the Z i.e. "08:00:000", it then saves it as "07:00:000". If time fields have no time zones, the 'Z' should either not be required or should have no bearing. Thanks for your time though Commented Sep 9, 2020 at 17:51

You must log in to answer this question.

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