Function to calculate working and overtime hour

  • Thread starter Thread starter Vensia
  • Start date Start date
V

Vensia

Dear all,

I want to make a function to calculate the normal working hour and overtime
hour.
In this case, I have a shift hour from 20:00 PM - 05:00 AM (one hour for
break 24:00 - 01.00 AM)
If someone works from 19:00 PM until 06:00 AM, then the result is 8 hours
for normal working hours and 2 hours for over time hours. The overtime is
calculated from 19:00 until 20:00 and 05:00 until 06:00.
Please help me how to write the function.
Thanks before.

Regards,
Vensia
 
Use numbers to represent the dates, and use the format() function to display
it.

I.e. Today's date can be represented by the number 38673. Say the person
"punches in" at 6:00 A.M. That would be 38673.25. Noon would be 38673.5, and
8:00 P.M. would 38673.833333. You simply need to subtract the punch-out time
minus the punch-in time, and come up with 8 hours, 0.3333333 (1/3 of a 24-
hour day). Simply convert the date/time information to two numbers (single or
double, not long or integer; the decimal information is critical) and
subtract them.
 
Back
Top