curatedapi

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.

Start date (YYYY-MM-DD) or date-time (2026-03-29T01:30:00+01:00). At most 40 characters.
End date or date-time, same kind as start. At most 40 characters.
IANA time zone for date-times without an offset, e.g. America/New_York.
Count the end date too (so Monday to Friday is 5 days, like spreadsheet NETWORKDAYS).
Days that are not business days. Options: sat_sun: Saturday and Sunday; fri_sat: Friday and Saturday; sun: Sunday only; fri: Friday only; none: no weekend days
Dates that are not business days. Up to 1000 items. One per line, or separated by commas.
More options: rounding and decimals
Precision and rounding
Rounding mode applied once to each result. Default half_even.
Round results to this many digits after the decimal point.
Round results to this many significant digits.

Examples

Result: Working days in a week, inclusive

Days
Days from start to end (negative if end is earlier); with include_end_date the end day is counted too.
5
Weeks
Whole weeks in days.
0
Remaining days
Days left after the whole weeks.
5
Years
Years in the years-months-days breakdown.
0
Months
Months in the breakdown.
0
Calendar days
Days in the breakdown.
4
Total months
Whole months between the dates.
0
Business days
Business days from start up to (not including) end, or including end when include_end_date is true.
5
Start weekday
Day of the week of start.
Monday
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 days

For 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

POST /v1/calc/date/differenceVersion 1
curl https://api.curatedapi.com/v1/calc/date/difference \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "start": "2026-10-19",
    "end": "2026-10-23",
    "include_end_date": true
  }'
The same call in Python
import os

import requests

payload = {
    "start": "2026-10-19",
    "end": "2026-10-23",
    "include_end_date": True,
}
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-10-19",
    "end": "2026-10-23",
    "include_end_date": true,
};
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 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.