Days between two dates
From 1 January to 11 January 2024 there are 10 days. Enter two dates to get the whole number of calendar days between them, plus a signed figure that shows whether the second date comes first. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Start
- 2024-01-01
- End
- 2024-01-11
- Days
- 10
- Signed days
- 10
- Start year
- 2,024
- Start month
- 1
This days-between-two-dates calculator takes two Gregorian calendar dates in strict YYYY-MM-DD form and returns the whole number of calendar days that separate them. The engine uses only deterministic proleptic Gregorian arithmetic: it validates that each day actually exists on the calendar, converts both triples into serial day counts, subtracts them, and reports both the absolute distance and the signed end-minus-start delta without network calls, random sampling, or the host clock.
Where day-span arithmetic fits in planning, billing, and software
Operations and finance teams count days between two dates when a policy defines a thirty-calendar-day payment window, when a notice must land a fixed number of days after an event, or when a retention period is stated as whole days between two stamps rather than a live clock. Analysts building cohorts use the same distance to label observation windows that start and end on known calendar days, avoiding off-by-one errors at month ends and leap days that appear when people subtract spreadsheet serial numbers by hand.
Educators and standards writers use the tool to demonstrate leap-day distances such as 2024-02-28 to 2024-03-01 versus the same pair in a common year without relying on opaque calculator apps that silently include times of day. Pair it with subtract-days, epoch conversion, or ISO week helpers when you need related calendar steps, and with other free deterministic tools when you are assembling a small lab of date utilities.
What you can do with it
Payment and notice windows
Measure whole calendar days between an invoice date and a due date, or between an event and a required notice day, without timezone drift.
Leap-year and month-end spans
Verify distances that cross February 29 only in leap years, and that month and year boundaries contribute the correct whole-day counts.
FAQ
What does the days-between-two-dates calculator cost?
It is free in your browser on this page.
Are weekends, holidays, or times of day included?
No. This tool counts pure Gregorian calendar days only. It does not skip business non-working days and does not parse times or time zones.
Does the order of the two dates matter?
Not for the main count, which is never negative. A second, signed figure keeps the direction: it turns negative when the end date is earlier than the start date.
Is the first day included in the count?
The count measures the distance from midnight to midnight, so 1 to 11 January gives 10 days, not 11. Two identical dates give 0.
How many days are there from 28 February to 1 March?
Two in a leap year such as 2024, because 29 February sits in between, and one in a common year. Every date is checked, so 29 February is only accepted in leap years.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/date/days-between \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"start":"2024-01-01","end":"2024-01-11"}'const res = await fetch("https://api.kit.forhosting.com/date/days-between", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"start": "2024-01-01",
"end": "2024-01-11"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/date/days-between",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"start": "2024-01-01",
"end": "2024-01-11"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/date/days-between", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"start":"2024-01-01","end":"2024-01-11"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"start":"2024-01-01","end":"2024-01-11"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/date/days-between", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"start": "2024-01-01",
"end": "2024-01-11"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "date.days_between",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
year_min | 1 |
year_max | 9999 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Classic checks include 2024-01-01 to 2024-01-11 yielding ten days, 2024-02-28 to 2024-03-01 yielding two days in a leap year, and identical endpoints yielding zero.
What a whole-day span means and what the response contains
Counting whole calendar days between two dates answers a different question from business-day counts, age in years and months, or timezone-aware timestamp subtraction: it measures pure civil distance on the Gregorian calendar, midnight to midnight, without skipping weekends, holidays, or daylight-saving transitions. If you need business days, subtract-days navigation, epoch conversion, or multi-format parsing, use those dedicated tools; this page answers only the whole-day Gregorian distance between two validated ISO dates. You supply a start date and an end date as strict YYYY-MM-DD strings; order does not have to be chronological because the absolute days field is always non-negative while signed_days preserves direction when the end is earlier than the start. The calculator validates that both days are real calendar days — February 29 only in leap years, thirty days in April, never day thirty-two — then returns the normalized start and end strings, days as the absolute whole-day distance, signed_days as serial end minus serial start, the component fields start_year, start_month, start_day, end_year, end_month, and end_day for easy piping into other tools, and a short formula reminder. Rejected cases include a missing start or end field, wrong shapes such as 2024/01/01, impossible months, days that do not exist such as 2023-02-29, and years outside one through 9999.
How start and end are read and how the count stays reproducible
Each string must match four digits, a hyphen, two digits, another hyphen, and two digits; leading or trailing spaces are trimmed, but partial dates, ordinal day-of-year alone, month names, and embedded times are not expanded here. After parsing, each year must fall between 1 and 9999, each month between 1 and 12, and each day between 1 and the true length of that month in that year, with leap years following the Gregorian rule of divisible by four except century years not divisible by four hundred. The preferred first field is start, but aliases from, date1, a, and begin are accepted so spreadsheets, query strings, and typed forms can reuse the same contract without renaming columns. The preferred second field is end, with aliases to, date2, b, and finish for the same reason. Internally the engine converts each civil triple to a proleptic Gregorian serial day count using the well-known days_from_civil mapping, subtracts serial start from serial end to obtain signed_days, then takes the absolute value for days — pure integer arithmetic that is bitwise stable across runtimes. Identical dates yield zero; reversing the pair flips only the sign of signed_days and leaves days unchanged. Pair the free browser run on this page with the priced API when you need the identical day span inside an automated pipeline.
Where day-span arithmetic fits in planning, billing, and software
On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a one-off check to a pipeline without changing the mathematical result.
Integration use cases
Deterministic test fixtures
Generate reproducible day-span numbers for unit tests, property checks, and CI assertions without depending on Date or the host clock.
Technical questions
How is the day count defined?
The engine converts both validated YYYY-MM-DD dates to proleptic Gregorian serial day counts and subtracts them. days is the absolute whole-day distance; signed_days is end minus start.
What happens with leap years and invalid dates?
Month lengths and leap days are validated on both endpoints. For example, 2024-02-29 is accepted, while 2023-02-29 is rejected with invalid_input.
Does order matter if end is before start?
days is always non-negative. signed_days is negative when end is earlier than start, so you can keep chronological direction when you need it.