Forum Discussion
JennWeber
3 years agoQrew Member
We use 7 AM and 6PM to calculate the Premium Hours:
var timeofday start =[Start-1];
var timeofday stop =[Stop-1];
var date Mydate = [Date];
var duration Hrs = $stop-$start;
//Start before 7AM, If stop after 7AM time between start and 7AM, otherwise hrs
var duration AM= If(Hour($Start)<7,If(Hour($Stop)>6.999,ToTimeOfDay("7 am")-$Start,$hrs),Hours(0));
//Stop after 6PMS, if start before 6PM calculate time after 6PM, otherwise hrs
var duration PM= If(Hour($Stop)>17.999, If(Hour($Start)<17.999,$Stop-ToTimeOfDay("6 pm"),$hrs),Hours(0));
Sum($AM,$PM)
IN a separate field, the regular hours would then be the total hours - the premium hours
------------------------------
Jenn Weber
------------------------------