I am using the formula below to convert a unix time stamp into central standard time, and account for DST. However, when I use the formula in my select criteria, like @closed_date in lastfullmonth, it takes forever to run. Is there any way to speed this up?
@closed_date
local datetimevar rec_date := dateadd("h",-6,dateadd("s",{call_req.close_date},date(1970,01,01)));
local datetimevar begin_date := datetime(year(rec_date),1,1,2,0,0);
local datetimevar work_date := dateadd("m",3,begin_date);
local datetimevar DLSStart := work_date - dayofweek(work_date) - 13;
work_date := dateadd("m",10,begin_date);
local datetimevar DLSEnd := work_date - dayofweek(work_date) + 8;
//if in DLS Timeframe, add 1 hour
if rec_date in DLSStart to DLSEnd then
local datetimevar result_date := DateAdd("h",+1,rec_date) else
local datetimevar result_date := rec_date;
result_date;
@closed_date
local datetimevar rec_date := dateadd("h",-6,dateadd("s",{call_req.close_date},date(1970,01,01)));
local datetimevar begin_date := datetime(year(rec_date),1,1,2,0,0);
local datetimevar work_date := dateadd("m",3,begin_date);
local datetimevar DLSStart := work_date - dayofweek(work_date) - 13;
work_date := dateadd("m",10,begin_date);
local datetimevar DLSEnd := work_date - dayofweek(work_date) + 8;
//if in DLS Timeframe, add 1 hour
if rec_date in DLSStart to DLSEnd then
local datetimevar result_date := DateAdd("h",+1,rec_date) else
local datetimevar result_date := rec_date;
result_date;