Days Between Dates Calculator
Calculate the whole-day difference between two calendar dates and show which date comes later.
How it works
Convert both calendar dates to UTC midnight and subtract them. Divide the millisecond difference by 86,400,000 to obtain whole calendar days without local daylight-saving shifts.
Formula / calculation method
Convert both dates to UTC midnight.difference in days = (end timestamp − start timestamp) ÷ 86,400,000 milliseconds.
Worked examples
- 1 January to 2 January is 1 day.
- 1 January to 31 January is 30 days because the difference counts elapsed day boundaries.
How many days are between two dates?
Choose a start date and an end date to calculate elapsed whole days. The standard result excludes the starting date, so January 1 to January 31 is a difference of 30 days.
- Elapsed-day difference: subtract the start date from the end date.
- Inclusive calendar count: add one only when the rule explicitly counts both endpoint dates.
- Leap days are included automatically when February 29 falls inside the interval.
Continue: Calculate age between dates · Calculate clock-time duration.
When this tool helps
Useful for deadlines, trips, project schedules, waiting periods, age-related date checks, event planning, invoices, and general calendar arithmetic.
Related calculations: time duration calculator and age calculator.
Browse this topic: Education, Age & Date Calculators · GPA, Grade & Date Calculation Guide.
Quick reference: Date difference examples
| Input | Result |
|---|---|
| 2026-01-01 → 2026-01-02 | 1 day |
| 2026-01-01 → 2026-01-31 | 30 days |
| 2026-01-01 → 2027-01-01 | 365 days |
Accuracy and definitions
Dates are compared at UTC midnight to avoid daylight-saving-hour changes affecting the count. The result is elapsed whole days, not an inclusive count of both endpoint dates.
Methodology & verification
- Method
- Convert both calendar dates to UTC midnight and subtract them. Divide the millisecond difference by 86,400,000 to obtain whole calendar days without local daylight-saving shifts.
- Verification
- The displayed formula is cross-checked against Solveberry regression cases before release. Calculator inputs and results stay in the browser.
- Last reviewed
- 2026-09-05
Results are calculated locally in your browser. Optional analytics do not include calculator input values or results.
Common questions
Why is January 1 to January 31 equal to 30 days?
Because the calculator measures elapsed time between the two dates. An inclusive count of calendar dates would be a different convention.
Does this handle leap years?
Yes. Native calendar date construction correctly includes February 29 in leap years.
How does the calculator handle calendar boundaries?
The method is shown on the page. Date calculations use explicit calendar dates rather than assuming every month has the same length.
Does this replace an official deadline or age determination?
No. For legal, eligibility or contractual decisions, verify the result against the rule or authority that defines the relevant date or age.