function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Time zones affected by DST

Does Salesforce takes care of the Time zones affected by DST.
Previous, to this clock change on last weekend, the records were flowing with the right time.
Now, we are getting the Date/time 1 hour more to the actual time.
i.e. Orders are coming to Salesforce from Cordys which has a time zone defined as BST (GMT + 1).
The user in Salesforce are also set to BST. But the values for the dates don't match.
Do we need to write a custom code to monitor this, or SF takes care of this?


you'll need to code for it.  While salesforce adjusts the display I don't believe any coding is accounted for.  Here's a bit I wrote this morning to test for DST.  since we're primarily North America our DST dates are the 1st sunday after the 1st monday of March through the 1st sunday of November, you may need to adjust based on your locale.


 /** test for Daylight savings time */ 
 public static boolean isDST(datetime dtDateTime) 
     date dtDate = dtDateTime.Date();
     date dtWeekStart = dtDate.toStartofWeek();
     integer yy = dtDateTime.Year();
     if(dtWeekStart >=(date.newInstance(yy,03,08)) && dtWeekStart <= (date.newInstance(yy,11,01))) 
         {return true;}
         {return false;}