A day with a lunch break
Paste a small example into the tool and change one part at a time.
The clock shows 8 hours 30 minutes between the two times. Take off 45 minutes and the row reads 7:45 and 7.75 hours, the figure a payroll form wants.
Type when each shift started and ended and how long the break was. You get the hours worked per day and the total, in hours and minutes and in decimal hours.
Last updated
Coddy teaches you by writing real code in your browser - interactive lessons, instant feedback, and AI help when you get stuck.
A time card asks one question per day: how long were you working? Take the end time, subtract the start time, then take off the unpaid break. 08:45 to 17:15 is 8 hours 30 minutes on the clock, and with a 45-minute lunch that leaves 7 hours 45 minutes worked. The calculator does this for every row and adds the rows together.
Payroll and most timesheet forms want hours as one decimal number, not hours and minutes. A minute is a sixtieth of an hour, so 45 minutes is 45 divided by 60, which is 0.75, and 7:45 becomes 7.75. Every shift and the total show both forms, and the total is also given in minutes. Type an hourly rate and you get the pay for those hours as well.
A shift whose end time is earlier than its start, such as 22:00 to 06:00, is read as ending the next day, so night shifts need no extra steps. You can add up to 31 rows, one for every day of a month. Nothing is saved, so write down the total before you close the page.
Fill in Start and End. The time fields are your browser's own, so they show AM and PM or a 24-hour clock depending on your settings. The first row starts as 09:00 to 17:00 with a 30-minute break; change it to your times.
Type the unpaid break in whole minutes, or 0 if there was none. The row shows the hours worked as h:mm and as decimal hours. If a time is missing or the break is longer than the shift, the row asks you to check it and is left out of the total.
Press Add another day. The new row copies the start, end and break of the row above, so a week of the same shift takes four presses. Change any day that was different, or remove a row with its cross.
The total shows the hours as h:mm, in decimal hours and in minutes. Type your pay per hour to see the pay for those hours, rounded to two decimals and shown without a currency symbol.
Divide the minutes by 60 and round to two places, as the calculator does. The last column shows how to read a line on a time card.
| Minutes | Decimal hours | On a time card |
|---|---|---|
| 1 | 0.02 | 8:01 is 8.02 hours |
| 5 | 0.08 | 8:05 is 8.08 hours |
| 6 | 0.10 | 8:06 is 8.10 hours |
| 10 | 0.17 | 8:10 is 8.17 hours |
| 12 | 0.20 | 8:12 is 8.20 hours |
| 15 | 0.25 | 8:15 is 8.25 hours |
| 20 | 0.33 | 8:20 is 8.33 hours |
| 25 | 0.42 | 8:25 is 8.42 hours |
| 30 | 0.50 | 8:30 is 8.50 hours |
| 35 | 0.58 | 8:35 is 8.58 hours |
| 40 | 0.67 | 8:40 is 8.67 hours |
| 45 | 0.75 | 8:45 is 8.75 hours |
| 50 | 0.83 | 8:50 is 8.83 hours |
| 55 | 0.92 | 8:55 is 8.92 hours |
Paste a small example into the tool and change one part at a time.
The clock shows 8 hours 30 minutes between the two times. Take off 45 minutes and the row reads 7:45 and 7.75 hours, the figure a payroll form wants.
Copy the original value, run the tool, then compare the result.
The end is earlier than the start, so the row reads it as the next morning and adds (ends the next day). 8 hours 30 minutes less the break is 8:00, or 8 hours.
Monday to Thursday: 09:00 to 17:30, break 30 Friday: 09:00 to 13:15, break 0 Pay per hour: 18
Enter Monday, press Add another day four times, then change the last row to Friday's times. Four days of 8:00 and a Friday of 4:15 make 36:15, which is 36.25 decimal hours or 2,175 minutes, and the pay line shows 652.50.
from datetime import datetime, timedelta
shifts = [("08:45", "17:15", 45), ("22:00", "06:30", 30)]total = timedelta()for start, end, brk in shifts: a = datetime.strptime(start, "%H:%M") b = datetime.strptime(end, "%H:%M") if b < a: b += timedelta(days=1) # ends the next day total += b - a - timedelta(minutes=brk)
print(total) # 15:45:00print(round(total.total_seconds() / 3600, 2)) # 15.75The same rule as the calculator: an end earlier than the start moves to the next day, and the break comes off. Dividing the total seconds by 3600 gives decimal hours, 15.75 for these two shifts.
Subtract the start time from the end time, then take off any unpaid break. 08:45 to 17:15 with a 45-minute break is 7 hours 45 minutes. The calculator does this for each row and adds the rows up.
Divide the minutes by 60. 15 minutes is 0.25, 30 minutes is 0.5 and 45 minutes is 0.75, so 7:45 is 7.75 hours. The chart on this page lists the common values.
No. 7:30 is 7 hours and 30 minutes, which is 7.5 decimal hours. 7.30 decimal hours is 7 hours and 18 minutes.
Yes. When the end time is earlier than the start time, the shift is read as ending the next day and the row says so. 22:00 to 06:00 with no break is 8 hours.
The exact total, in hours, is multiplied by your pay per hour and rounded to two decimals. There is no currency symbol and no overtime rule, so every hour is paid at the one rate you type.
Each row's decimal hours are rounded to two places, but the total is worked out from the exact minutes. Three rows of 7:20 show 7.33 each, while their total of 22:00 is exactly 22.
A time is missing in that row, or the break is longer than the shift. The row is left out of the total until you fix it.
Up to 31 rows, enough for every day of a month. Each new row copies the times and break of the row above it.
No. The calculator runs in your browser and sends nothing, and it saves nothing either, so the rows are gone when you reload or close the page.