How Date Duration is Calculated (Calculation Method)
Calendar date spans require accounting for variable month lengths, leap year insertions, and UTC midnight alignments.
Elapsed Days = (End Date UTC - Start Date UTC) ÷ 86,400,000 milliseconds
UTC Epoch Normalization
Convert start date and end date into UTC midnight timestamps to eliminate local daylight saving shifts.
Full Year & Month Iteration
Determine full years and full months completed between start and end dates based on Gregorian calendar rules.
Leap Year & Feb 29 Check
Identify whether February 29th occurs within the date interval and add 86,400 seconds if applicable.
Total Unit Breakdown
Output total days, total weeks, total hours, and total seconds elapsed between the two dates.