The reason for this formula is to determine when daylight savings occurs.
For example:
Currently I have an application that saves data in Greenwich Mean Time and I’m on US Central time.
So when I run a report to view data for a 24hr period, I have to either add 5 or 6 hours dynamically to the date and time that the user is passing in To accurately get the data for the 24hr period.
So lets say that @DTFROM is the From Date that the user is passing in like in the last example
Once I know if the date that the user is passing in occurred during daylight savings time than I add 5hrs if not than 6hrs
if @ DTFROM > @Spring_date and @ DTFROM < @Fall_date
begin
set @ DTFROM = dateadd(hour,5,@FDT)
end
else
begin
set @ DTFROM = dateadd(hour,6,@FDT)
end
im sure you can find other uses but that’s the reason why I use it