Forum Discussion
null null
Jul 05, 2018Copper Contributor
Date range with time window to do SLA statistcs
Dear community, i struggle around with following: I need to write a query which displays availabilityResults within business hours and out of business hours. Mo-Fr: 08:00 - 18:00 and out...
Meir_Mendelovich
Microsoft
Jul 05, 2018Hi,
The query language have rich set of functions to calculate time differences. Here is a sample calculation:
let StartDate = now()-7d;
let StartDate8am = make_datetime(getyear(StartDate),getmonth(StartDate),dayofmonth(StartDate),8,0);
let StartDate8amWorkWeek = iif(dayofweek(StartDate8am) >= 1d and dayofweek(StartDate8am) <= 5d, StartDate8am, make_datetime(getyear(StartDate8am),getmonth(StartDate8am),1,hourofday(StartDate8am),0));
print StartDate8amWorkWeek
Hope it helps,
Meir
The query language have rich set of functions to calculate time differences. Here is a sample calculation:
let StartDate = now()-7d;
let StartDate8am = make_datetime(getyear(StartDate),getmonth(StartDate),dayofmonth(StartDate),8,0);
let StartDate8amWorkWeek = iif(dayofweek(StartDate8am) >= 1d and dayofweek(StartDate8am) <= 5d, StartDate8am, make_datetime(getyear(StartDate8am),getmonth(StartDate8am),1,hourofday(StartDate8am),0));
print StartDate8amWorkWeek
Hope it helps,
Meir