Calculate Time Worked

Work Hours Calculator

Calculate total time worked and gross pay easily

Total Time:
Decimal Hours:
Gross Pay:

How to Calculate Time Worked

Calculating your worked hours accurately is essential for ensuring fair compensation and tracking productivity. This calculator handles the math for you, including break deductions and overnight shifts.

The Manual Formula

To calculate time worked manually, follow these steps:

  1. Convert the Start and End times into a 24-hour format (Military Time).
  2. Subtract the Start Time from the End Time.
  3. Subtract any unpaid break time from the total.
  4. To find your pay, multiply the decimal hours by your hourly rate.

Working with Decimal Hours

Payroll systems often use decimal hours rather than hours and minutes. For example, 7 hours and 30 minutes is 7.5 hours. To convert minutes to decimals, divide the minutes by 60.

Example Calculation:
Start: 8:30 AM | End: 5:00 PM (17:00)
Elapsed Time: 8 hours 30 minutes
Break: 45 minutes
Total Worked: 7 hours 45 minutes (7.75 hours)

Frequently Asked Questions

Does this handle shifts that go past midnight?
Yes, the calculator automatically detects if the end time is earlier than the start time and assumes the shift ended on the following day.

Should I include paid breaks?
No. If your break is paid, leave the "Break Duration" field at 0. Only input unpaid break time.

function calculateWorkTime() { var startStr = document.getElementById("startTime").value; var endStr = document.getElementById("endTime").value; var breakMin = parseFloat(document.getElementById("breakMinutes").value) || 0; var rate = parseFloat(document.getElementById("hourlyRate").value) || 0; if (!startStr || !endStr) { alert("Please enter both Start and End times."); return; } var startParts = startStr.split(":"); var endParts = endStr.split(":"); var startTotalMinutes = (parseInt(startParts[0]) * 60) + parseInt(startParts[1]); var endTotalMinutes = (parseInt(endParts[0]) * 60) + parseInt(endParts[1]); // Handle overnight shifts if (endTotalMinutes < startTotalMinutes) { endTotalMinutes += 24 * 60; } var totalMinutesWorked = endTotalMinutes – startTotalMinutes – breakMin; if (totalMinutesWorked < 0) { alert("Calculation error: Breaks cannot be longer than the total shift time."); return; } var hours = Math.floor(totalMinutesWorked / 60); var minutes = totalMinutesWorked % 60; var decimalHours = totalMinutesWorked / 60; var grossPay = decimalHours * rate; // Update UI document.getElementById("timeResult").style.display = "block"; document.getElementById("displayHours").innerText = hours + "h " + minutes + "m"; document.getElementById("displayDecimal").innerText = decimalHours.toFixed(2) + " hours"; document.getElementById("displayPay").innerText = "$" + grossPay.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}); }

Leave a Comment