+ Start a Discussion
imAkashGargimAkashGarg 

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?

bouscalbouscal

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;}
     else 
         {return false;}
 }