Calculation Methodology & Formulas
At ThisThatHub, transparency is paramount. Below is the precise mathematical documentation of how our engine normalizes time values, handles cross-midnight shifts, deducts breaks, and converts clock time into decimal hours.
1. Time Normalization & Parsing
All user inputs (whether entered as standard 12-hour AM/PM like "8:00 AM", 24-hour military like "1730", or shorthand numbers like "8") are normalized into an integer value representing minutes elapsed since midnight (0 to 1439):
For PM times (excluding 12:00 PM noon), 12 hours (720 minutes) are added. For 12:00 AM midnight, the hour is evaluated as 0.
2. Elapsed Duration & Midnight Crossover
To determine the gross elapsed time of a work shift:
Gross Minutes = End Minutes − Start MinutesWhen a worker clocks in during the evening (e.g. 10:00 PM = 1320 min) and clocks out the following morning (e.g. 6:30 AM = 390 min):
Gross Minutes = (1440 − Start Minutes) + End MinutesExample: (1440 − 1320) + 390 = 120 + 390 = 510 minutes (8 hours and 30 minutes).
3. Unpaid Break Deductions
Net payable work hours subtract unpaid break minutes directly from gross shift duration:
Validation safeguard: If the user inputs a break duration exceeding the total shift length, the engine flags a validation warning rather than outputting nonsensical negative work hours.
4. Decimal Hours Conversion
Payroll accounting software requires hours formatted in base-10 decimal numbers:
For high-precision needs, the engine can also output to 4 decimal places: `Round((Minutes ÷ 60), 4)`.
5. Overtime & Gross Pay Estimation
When an hourly wage rate is entered, pay is calculated from user-defined thresholds: