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: Across a daylight saving change

Total seconds
Exact elapsed seconds (date-times).
82800 exact
Total minutes
Elapsed minutes (date-times).
1380 exact
Total hours
Elapsed hours (date-times).
23 exact
Total days
Elapsed days of 24 hours (date-times).
0.958333333333333 rounded
Elapsed days
Whole days in the elapsed time (date-times).
0
Elapsed hours
Hours after the whole days (date-times).
23
Elapsed minutes
Minutes after the whole hours (date-times).
0
Elapsed seconds
Seconds after the whole minutes, exactly (date-times).
0
Tz database
Time zone database version used.
tzdata 2026.6 (IANA 2026f)

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-03-28T12:00:00",
    "end": "2026-03-29T12:00:00",
    "timezone": "Europe/Berlin"
  }'
The same call in Python
import os

import requests

payload = {
    "start": "2026-03-28T12:00:00",
    "end": "2026-03-29T12:00:00",
    "timezone": "Europe/Berlin",
}
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-03-28T12:00:00",
    "end": "2026-03-29T12:00:00",
    "timezone": "Europe/Berlin",
};
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.