taylorsharpe

Daylight Savings calculation for a given year optimization

Discussion created by taylorsharpe on Jun 2, 2014
Latest reply on Jun 3, 2014 by taylorsharpe

I have a calcluation where the input is a 4 digit year and the output are the start and end dates for Daylight Savings Time for a given year where I live (in Texas). I was doing this to know when to make adjustments to the UTC time for local time.

 

This formula works... but being a bit OCD and knowing the efficiency of others on here, I was looking to try to make this a shorter calculation. So who can help make this calculation more "efficient"?

 

 

 

Let ( [

 

F1 = $Year ;

F2 = DayOfWeek ( Date ( 3 ; 1 ; F1 ) ) ; // Daylight Savinings Starts the 2nd Sunday of March

F3 = Case (

F2 = 7 ; 9 ;

F2 = 1 ; 8 ;

F2 = 2 ; 14 ;

F2 = 3 ; 13 ;

F2 = 4 ; 12 ;

F2 = 5 ; 11 ;

F2 = 6 ; 10 ) ;

F4 = Date ( 3 ; F3 ; F1 ) ; // Start Daylight Savings

 

F5 = DayOfWeek ( Date ( 11 ; 1 ; F1 ) ) ; // Daylight Savings Ends the 1st Sunday of November

F6 = Case (

F5 = 7 ; 2 ;

F5 = 1 ; 1 ;

F5 = 2 ; 7 ;

F5 = 3 ; 6 ;

F5 = 4 ; 5 ;

F5 = 5 ; 4 ;

F5 = 6 ; 3 ) ;

F7 = Date ( 11 ; F6 ; F1 ) // End Daylight Savings

 

] ;

 

F4 & ¶ & F7

 

)

Outcomes