Mathematical Logic for Computing Overnight Cross-Midnight Work Shifts
Step-by-step algorithmic breakdown for splitting graveyard hours across midnight, deducting unpaid rest periods, and computing gross night differential wages.
Net Payable Hours = ((1440 - Start Minutes) + End Minutes - Break Minutes) ÷ 60
Time Normalization & 24-Hour Conversion
Convert start time and end time from 12-hour AM/PM notation into standard 24-hour integer minutes (e.g., 10:30 PM = 22 × 60 + 30 = 1350 minutes).
Midnight Crossing Detection & Segment Splitting
If end time is less than start time, the shift crosses midnight (1440 minutes). Split into Pre-Midnight Minutes (1440 - Start Time) and Post-Midnight Minutes (End Time).
Unpaid Meal Break Deduction
Sum the two segments to obtain Gross Elapsed Minutes, then subtract unpaid lunch duration to isolate Net Compensable Labor Minutes.
Decimal Conversion & Differential Wage Calculation
Divide Net Minutes by 60 to obtain Base-10 Decimal Hours. Apply flat or percentage night shift differential to calculate gross payroll compensation.