x402AgentTools

๐Ÿ“…Date Difference Calculator

Count the total days between two dates, plus the breakdown in weeks and days and in calendar years, months and days.

Worked examples

2024-01-01 โ†’ 2024-12-31

GET /api/v1/calculators/date-difference-calculator?start=2024-01-01&end=2024-12-31

Result: 365 days

2020-02-28 โ†’ 2020-03-01 (leap year)

GET /api/v1/calculators/date-difference-calculator?start=2020-02-28&end=2020-03-01

Result: 2 days

1990-06-15 โ†’ 2026-09-01

GET /api/v1/calculators/date-difference-calculator?start=1990-06-15&end=2026-09-01

Result: 13,227 days

Machine API (x402)

$0.001 / call

This tool is also a JSON API for AI agents. Requests without payment receive 402 Payment Required plus instructions; agents pay USDC on Base via the x402 protocol โ€” no accounts, no API keys.

GET /api/v1/calculators/date-difference-calculator?start=2024-01-01&end=2024-12-31 HTTP/1.1
Host: agenttools-hub.vercel.app

โ†’ 402 (payment required, instructions in headers)
โ†’ 200 (after X-PAYMENT header; JSON body below)

{
  "tool": "calculators/date-difference-calculator",
  "input": {"start":"2024-01-01","end":"2024-12-31"},
  "result": { "value": 365, "answer": "365 days" }
}

Agent docs: /llms.txt ยท OpenAPI spec ยท integration guide

About this tool

Enter two ISO dates (YYYY-MM-DD) to get the exact number of days between them, the weeks-and-days breakdown, the calendar years/months/days split, and total hours.

total days = (end UTC midnight โˆ’ start UTC midnight) รท 86,400 seconds

Frequently asked questions

Does the count include both end days?

The result is the difference between the two dates (end minus start). Add 1 to include both the first and the last day in a count.

How are leap years handled?

The calculation uses real calendar arithmetic on UTC timestamps, so Feb 29 is counted exactly as it occurs.

Are time zones considered?

Both dates are interpreted as midnight UTC, so results are independent of your local time zone.

Related tools