Have you tired to do the calculations by hand?
11:00 less 8:00 would be 660 - 480 or 180 minutes (3 hours 0 minutes)
5:00 less 12:00 would be 300 - 720 or - 420 minutes (-7 hours 0 minutes)
Then 180 + (-420) would be -240 minutes (-4 hours0 minutes)
You have to specify whether the hours are before or after Noon. The hours after 12:00pm are 12 hours after the same hours beform 12:00pm. If you were to add 720 (12 hours) to the 5:00 in the afternoon, you would have the correct answer. You need to be able to tell the difference between times before 12:00pm and times after 12:00pm.
Instead of reinventing the wheel you should search "Time sheet" on this forum, there are some nice examples to download around here.
I was able to get the time to calculate somewhat based on sample time sheet I found on this website but still need help.
I have uploaded my time sheet sample to Drop Box - https://www.dropbox.com/s/ic22gs7rx1h8ny4/Test_Payroll_Sheet.pdf?dl=0
- Second scenario shows that I was able to figure out calculation for first in/out group then not sure how to add the after break time.
- Third shows that if someone enters start time and skips to out and leave the two boxes in between empty the calculation doesn't work. We have people who do this all the time.
Any help is appreciated.
For scenario three, you need to decide how to handle this situation. In the samples I have posted I do not compute the result for a pair on in and out times unless the start and end times are present. I chose to not add the additional code to verify that all the pairs of entries are added. Most employers do not process timesheets that are not properly completed. If one were to leave the start or end times empty the calculations will tread the empty time value as if it were midnight of the day or if the day were also missing then date and time is assumed to be Midnight January 1, 1970 or the Epoch date for the scripting language and Operating System being used.
Your calculations will work properly if the time interval you are trying to compute includes the time period when there is the change of time for the ending of daylight savings time or summer time.