# Need a formula for Daylight Savings Time

I am having trouble creating a formula for Daylight Savings Time. I have a DateTime field that is in GMT (Greenwich Mean Time). I have come up with a formula which will display the time depending on the time zone the account is in. However, now that Daylight Savings Time has started, my times are an hour off. I can go in and correct the formula to subtract an hour less, but I'm just going to have to correct the report again in the fall. I would rather the formula be created to handle DST on it's own automatically.

DST starts on the second Sunday of March and ends on the first Sunday in november.
###### Who is Participating?

Commented:
Here are the formulas

In the adjustment, just change the -3/-4 to the appropriate difference

THe formula for the 2nd Sunday and 1 Sunday was supplied by

mlmcc
``````Formula for Setting the START of DST
WhilePrintingRecords;
DateVar D:= Date(Year({tblHoursWorked2011.Started}),3,1);  //Today's Date or any date field
Numbervar DOW:= 1; //The day of week you want with 1 being Sunday, 2 = Monday, etc
NumberVar Week:= 2; // The Week you want, 1 being the FIRST Monday of the month, 2 being the second, etc
DateVar BOM:= D - Day(D)+(8-DOW);
DateVar BOW:= BOM - DayOfWeek(BOM) + DOW  + (7*(Week-1));
Global DateVar DSTStartDate := BOW

Formula for Setting the END of DST
WhilePrintingRecords;
DateVar D:= Date(Year({tblHoursWorked2011.Started}),11,1);  //Today's Date or any date field
Numbervar DOW:= 1; //The day of week you want with 1 being Sunday, 2 = Monday, etc
NumberVar Week:= 1; // The Week you want, 1 being the FIRST Monday of the month, 2 being the second, etc
DateVar BOM:= D - Day(D)+(8-DOW);
DateVar BOW:= BOM - DayOfWeek(BOM) + DOW  + (7*(Week-1));

Global DateVar DSTEndDate := BOW

WhilePrintingRecords;
Global DateVar DSTStartDate;
AND
Else
``````
0

Commented:
This will work for this year.  I'll work on one that works in general.
Use the appropriate differences based on time zone

If {YourDateTimeField} >= DateTime(2011,3,13,2,0,0)
AND
{tblHoursWorked2010.Started} < Date(2011,11,13,2,0,0) then
Else

mlmcc
0

Author Commented:
This formula works for now, but is there a way to make the formula automatically update for the time change without me having to modify the report twice a year? Daylight Savings Time begins on the 2nd Sunday of March every year and ends on the 1st Sunday in November.
0

Commented:
I am sure there is.  I meant to try to do it but forgot.  Let me try a few things.

mlmcc
0

Author Commented:
Worked perfectly! Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.