Date difference calculator
Days, weeks, months, years and business days between two dates, or the exact time between two date-times across time zones and daylight saving changes.
- Version 1
- Checked against 3 published values
- Free, no sign-up
Result: Days until Christmas 2026
| Days Days from start to end (negative if end is earlier); with include_end_date the end day is counted too. |
358 |
|---|---|
| Weeks Whole weeks in days. |
51 |
| Remaining days Days left after the whole weeks. |
1 |
| Years Years in the years-months-days breakdown. |
0 |
| Months Months in the breakdown. |
11 |
| Calendar days Days in the breakdown. |
24 |
| Total months Whole months between the dates. |
11 |
| Business days Business days from start up to (not including) end, or including end when include_end_date is true. |
256 |
| Start weekday Day of the week of start. |
Thursday |
| End weekday Day of the week of end. |
Friday |
Rounding: Half even, 15 significant digits. Calculator date/difference@1.
How it is calculated
days = end − start; Y-M-D: largest whole months not passing end, then daysFor two dates, returns the number of days (end minus start), the breakdown into years, months and days, and the number of business days. For two date-times, returns the exact elapsed time; each date-time needs a UTC offset or a time zone, and times that are skipped or repeated by daylight saving changes are reported instead of guessed.
- Dates use the Gregorian calendar (ISO 8601). Adding months clamps to the month's last day (Jan 31 + 1 month = Feb 28 or 29).
- Time zones come from the IANA time zone database in the pinned tzdata package; the version used is returned with each date-time result.
- When end is before start, every count is negative.
- include_end_date changes days, weeks and business_days; the years-months-days breakdown is always the exact span from start to end.
- Leap seconds are not counted.
References
Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.
Use it from your code
curl https://api.curatedapi.com/v1/calc/date/difference \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"start": "2026-01-01",
"end": "2026-12-25"
}'
The same call in Python
import os
import requests
payload = {
"start": "2026-01-01",
"end": "2026-12-25",
}
response = requests.post(
"https://api.curatedapi.com/v1/calc/date/difference",
headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
json=payload,
timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
"start": "2026-01-01",
"end": "2026-12-25",
};
const response = await fetch("https://api.curatedapi.com/v1/calc/date/difference", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CURATEDAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log((await response.json()).result);
MCP tool calc_date_difference at https://mcp.curatedapi.com.
Inputs, outputs and errors in the API reference.
Put it on your website
<div data-curatedapi-widget="date/difference" data-key="capi_public_…"></div>
<script src="https://widgets.curatedapi.com/v1/widget.js" async></script>
Use a public key registered for your site. Calculations are billed like API calls. How widgets work.
Related calculators
- Add or subtract time from a date
- Age calculator
- Public holidays by country and year
- Time zone converter
- Working days calculator with public holidays
- Working hours and SLA deadline calculator
Add this calculator to your website
Paste two lines into your page and your visitors get this calculator. Each use counts as one call on your plan, the same as the API.
Free for up to 1,000 uses a month. 50,000 uses a month cost $9.00 on the Starter plan.