Skip to main content
Question

Calculate Normal Hours and OT Hours


Forum|alt.badge.img+6
I need to calculate hours that are considered OT or Premium vs Standard Hours based on a end-user in and out time.

I am asking the end-user to enter their in and out time as part of the form.  If the in time is before 7 AM EST then those hours from the designated start to 7 AM would be Premium.  In the reverse any time worked past 5 PM would be premium.  

Example: 
In Time: 6 AM
Out Time: 6 PM

Regular Hours: 10
Premium Hours: 2

How do I make these calculations?

------------------------------
Joshua Case
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+1
  • Registered
  • March 4, 2022

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
------------------------------