### Title

Need help on COMPLEX Time calculations

### Post

I have a situation where an employee shift starts at 11:00 PM on a Thursday for example. The employee shift ends at 7:30 am Friday (the next day).

Here is the calculation that I use to figure hours worked because of the shift starting on one day and ending on the following day:

Case ( Exclude Lunch = "YES" ; Round ((( TimestampEnd - TimestampStart) / 3600)-.5 ; 2 ); Exclude Lunch = "NO" ; Round (( TimestampEnd - TimestampStart) / 3600 ; 2 ))

Here is where I need to get more technical

The one hour before Thursday midnight is a different pay scale than the 7-1/2 hours on Friday morning midnight shift.

FIRST Calculation Result - I need to create a calculation that takes the timestamped one hour, or two hours, or three hours (etc.) Before midnight on Thursday - and does a calculation that places the amount of hours into a "Standard Pay Rate HOURS Field".

SECOND Calculation Result - I need to create a calculation that takes the timestamped 7-1/2 hours, or 9 hours, or 10-1/4 hours (etc.) AFTER midnight on Friday - and does a calculation that places those amount of hours into a "Shift Pay Rate Hours Field".

Can someone please help me on this complex calculating?

Thanks for your help,

Dekade

Assuming that this calculation takes place at the moment the worker "clocks out" (about the same time as TimestampEnd):

StandardHours:

Let ( Thu = GetAsTimeStamp ( GetasDate ( Get ( CurrentTimeStamp) ) - DayOfWeek ( Get ( CurrentTimeStamp) ) + 5 & " 12:00 am " ) ;

If ( Thu < TimeStampEnd ; Thu - TimeStampStart ; TimeStampEnd - TimeStampStart )

) / 3600

ShiftPayHours:

Let ( Thu = GetAsTimeStamp ( GetasDate ( Get ( CurrentTimeStamp) ) - DayOfWeek ( Get ( CurrentTimeStamp) ) + 5 & " 12:00 am " ) ;

If ( Thu > TimeStampStart ; TimeStampEnd - TimeStampStart ; TimeStampEnd - Thu )

) / 3600