Georgedooley
Technical User
hi
I'm trying to calculate working hours from the open time of a ticket to the close time.
Working hours are
Mon - Fri 6am - 7pm
Saturday - 6am - 10am.
I can do the mon - fri calculation but because the hours are different on saturday its giving me some problems.
Formula used is.
//Working Days
WhileReadingRecords;
Local DateVar Start := date({@Open Date});
Local DateVar End := date({@Close Date});
Local NumberVar Days;
Local Numbervar Hol;
DateVar Array Holidays;
Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
Local NumberVar i;
For i := 1 to Count (Holidays)
do (if DayOfWeek ( Holidays ) in 2 to 6 and
Holidays in start to end then Hol:=Hol+1 );
Weeks + Days - Hol
-------------------------------------------------
//Working Hours
WhileReadingRecords;
NumberVar Days := {@working days};
TimeVar SetStart := TimeValue( "6:00");
TimeVar SetEnd := TimeValue("19:00");
TimeVar StartTime := TimeValue({@Open Date});
TimeVar EndTime := TimeValue({@Close Date});
Days * ((SetEnd - SetStart) / 3600)
- ((SetEnd - EndTime) / 3600)
- ((StartTime - SetStart) / 3600)
Thanks in advance.
I'm trying to calculate working hours from the open time of a ticket to the close time.
Working hours are
Mon - Fri 6am - 7pm
Saturday - 6am - 10am.
I can do the mon - fri calculation but because the hours are different on saturday its giving me some problems.
Formula used is.
//Working Days
WhileReadingRecords;
Local DateVar Start := date({@Open Date});
Local DateVar End := date({@Close Date});
Local NumberVar Days;
Local Numbervar Hol;
DateVar Array Holidays;
Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
Local NumberVar i;
For i := 1 to Count (Holidays)
do (if DayOfWeek ( Holidays ) in 2 to 6 and
Holidays in start to end then Hol:=Hol+1 );
Weeks + Days - Hol
-------------------------------------------------
//Working Hours
WhileReadingRecords;
NumberVar Days := {@working days};
TimeVar SetStart := TimeValue( "6:00");
TimeVar SetEnd := TimeValue("19:00");
TimeVar StartTime := TimeValue({@Open Date});
TimeVar EndTime := TimeValue({@Close Date});
Days * ((SetEnd - SetStart) / 3600)
- ((SetEnd - EndTime) / 3600)
- ((StartTime - SetStart) / 3600)
Thanks in advance.