1

Documentation leads me to say these times are set to UTC always;

If the Event IsAllDayEvent flag is set to false (indicating that it is not an all-day event), then the event start date information is contained in the StartDateTime field. The time portion is always transferred in the Coordinated Universal Time (UTC) time zone. You need to translate the time portion to or from a local time zone for the user or the application, as appropriate.

but when I try adding a recurring event which crosses a time when clocks move forward/backward the hours changes when running a SOQL in the developer console. See below;

enter image description here

select id, subject, startdatetime from Event order by startdatetime

You can see the hour goes back from 8am to 7am during the weekend of 6th October, but UTC time never changes, so this is GMT surely no?!

2
  • It's formatted to local (civil) date/time, perhaps incorrectly. Curious as to your SOQL expression, could you please update your question. – identigral Sep 11 '19 at 17:45
  • Added the SOQL, but when you say Local/Civil do you mean what is set on my computer or what is set for the user as I find both of these do not affect the results I get from SOQL? – r0bb077 Sep 12 '19 at 1:46
1

Edited

Cordinated Universal Time or UTC is a time standard that is used to keep time synchronized across the world while Greenwich Mean Time - GMT (UTC-0) is the same time zone as the UTC base time zone standard but predates it by 300 years.

Time zones around the world are expressed using positive or negative offsets from UTC, as in the list of time zones by UTC offset. The westernmost time zone uses UTC−12, being twelve hours behind UTC; the easternmost time zone, uses UTC+14, being fourteen hours ahead of UTC. In 1995, the island nation of Kiribati moved those of its atolls in the Line Islands from UTC−10 to UTC+14 so that Kiribati would all be on the same day.

From Wikepedia:

UTC does not change with a change of seasons, but local time or civil time may change if a time zone jurisdiction observes daylight saving time (summer time). For example, local time on the east coast of the United States is five hours behind UTC during winter, but four hours behind while daylight saving is observed there.[26]

To answer your question more specifically, Salesforce stores all records in UTC which does not change. Records are then opened in the user's local time. If the local time jurisdiction observes daylight saving time, the time will be adjusted accordingly.

5
  • That would make sense but what does "The time portion is always transferred in the Coordinated Universal Time (UTC) time zone." mean in the documentation? a bit misleading no or am I missing something?! – r0bb077 Sep 11 '19 at 15:31
  • UTC is simply the specification for how the Time Zones are designated, managed, specified, date times translated between them, etc. Its similar to ISO. – crmprogdev Sep 11 '19 at 19:48
  • Is there any documentation to lead us into knowing results are returned as GMT? Just seems quite confusing to not state this on the Event page (developer.salesforce.com/docs/atlas.en-us.api.meta/api/…) withthe rest of the info.Thanks for your help @crmprogdev – r0bb077 Sep 12 '19 at 1:58
  • See my edited answer. I think it explains precisely why you see the results you're getting. My original references weren't accurate. – crmprogdev Sep 12 '19 at 13:44
  • Thanks for the help @crmprogdev. I think I just got myself into a whole load of headmess around this. – r0bb077 Sep 13 '19 at 0:48

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.