Try this formula for counting minutes
Disregards weekends and works out time between stHour (e.g. 7 for 7am) and endHour (e.g. 18 for 6pm), which you can set in the code or lookup.
If a call is closed on a weekend sets that to close of the day Friday. Likewise, a call opened on a weekend is thought of as starting first thing Monday.
You could also look up holidays in the directory if you wanted to, & discount the time for those.
checkClosed := @If(Status = "Closed" & @IsDocBeingSaved;"";@Return("")); checkDate := @If(dtOpened > dtClosed;@Return(0);""); stHour := 7; endHour := 18; diffHour := (endHour-stHour) *60; dateClosed := @If(@WeekDay(dtClosed) = 7 ; @TextToTime(""" + @Text(@Date(@Adjust(dtClosed;0;0;-1;0;0;0))) + " " + @Text(endHour) + ":00");@If(@WeekDay(dtClosed) = 1 ; @TextToTime(""" + @Text(@Date(@Adjust(dtClosed;0;0;-2;0;0;0))) + " " + @Text(endHour) + ":00");dtClosed)); dateOpen := @If(@WeekDay(dtDue) = 7 ; @TextToTime(""" + @Text(@Date(@Adjust(dtDue;0;0;2;0;0;0))) + " " + @Text(stHour) + ":00");@If(@WeekDay(dtDue) = 1 ; @TextToTime(""" + @Text(@Date(@Adjust(dtDue;0;0;1;0;0;0))) + " " + @Text(stHour) + ":00");dtDue)); diffHours := ((dateClosed - dateOpen) / 60) ; diffDays := (dateClosed - dateOpen) / 86400 ; strtDay := @Modulo(@Weekday(dateOpen); 7); endDay := @Modulo(@Weekday(dateClosed); 7); tdiffDays := @Round(((diffDays - endDay + strtDay - 8) * 5 / 7 - @Max(-2; -strtDay) - @Min(1;
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.
endDay) + 5 - strtDay + endDay)); diffMinend := @If(((@Hour(dateClosed)*60) + @Minute(dateClosed)) > (endHour*60); endHour*60; (@Hour(dateClosed)*60) + @Minute(dateClosed)); diffMinstart := @If((@Hour(dateOpen)*60) + @Minute(dateOpen) < (stHour*60); stHour*60; (@Hour(dateOpen)*60) + @Minute(dateOpen)); diffMins := diffMinend - diffMinstart; daysMinEnd := (@If(((@Hour(dateClosed)*60) + @Minute(dateClosed)) > (endHour*60); endHour*60; (@Hour(dateClosed)*60) + @Minute(dateClosed))) - stHour*60; daysMinStart := endHour*60 - (@If((@Hour(dateOpen)*60) + @Minute(dateOpen) < (stHour*60); stHour*60; (@Hour(dateOpen)*60) + @Minute(dateOpen))); @If(tdiffDays = 0 ;diffMins; @If(tdiffDays = 1;daysMinEnd + daysMinStart; (daysMinEnd + daysMinStart) + ((tdiffDays -1)*diffHour) ));
This was first published in July 2001