Add or subtract days from a date
28 December 2024 plus 5 days is 2 January 2025. Enter a date and a number of days, positive to go forward or negative to go back, and get the exact calendar date with weekends counted. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Date
- 2024-12-28
- Days
- 5
- Result
- 2025-01-02
This date calculator moves a real Gregorian calendar date forward or backward by any supported whole number of calendar days. Enter a strict ISO date and a positive, negative, or zero day count to receive the resulting date. The calculation handles short and long months, leap days, century rules, and year boundaries without relying on a device clock, time zone, or daylight-saving setting.
Enter a precise date and signed day count
Provide the starting date in strict YYYY-MM-DD form, using four digits for the year and two digits each for the month and day. Fixed-width input removes regional ambiguity: 2026-04-09 always means April ninth, never September fourth. The date must genuinely exist in the proleptic Gregorian calendar.
April thirty-first is invalid, as is February twenty-ninth in a common year. For the second field, enter a whole number of days. Positive values move into the future, negative values move into the past, and zero returns the starting date unchanged.
The count represents calendar days, so every midnight crossed counts once. Saturdays, Sundays, and holidays are included; use a business-day tool when those days must be skipped. The calculator accepts dates from year 0001 through year 9999 and rejects an operation whose result would leave that range.
It also rejects fractional, infinite, unsafe, or missing day counts.
How rollover and leap years are calculated
The calculation first validates the year, month, and day against Gregorian month lengths. February normally contains twenty-eight days, but contains twenty-nine when the year is divisible by four, except century years must also be divisible by four hundred. Therefore 2000 and 2024 are leap years, while 1900 and 2100 are not.
After validation, the civil date is mapped to an integer ordinal representing its exact position in the calendar. The signed day count is added to that ordinal, and the new ordinal is converted back to a year, month, and day. This approach naturally crosses the end of February, thirty-day months, December, and multiple years in either direction.
It avoids iterative clock manipulation and never constructs a JavaScript Date value. That matters because clock-based date operations can inherit a runtime time zone or daylight-saving transition even when the problem concerns calendar days only. Here the operation uses deterministic integer arithmetic, has no network dependency, and reads no current time.
Use the result safely in real workflows
The compact output is easy to store as a database value, compare in tests, place into an invoice record, or pass to a later workflow step. Common uses include calculating a calendar-day payment deadline, moving a campaign date, generating renewal reminders, building retention cutoffs, and producing expected dates for software tests. Remember that this capability performs calendar arithmetic, not time arithmetic.
It does not attach a time of day, time zone, UTC offset, weekday policy, holiday calendar, or end-of-month business convention. For example, adding one day always advances to the next calendar date, even if that date is a Sunday or public holiday.
What you can do with it
Calculate calendar deadlines
Add a contractual number of calendar days to a filing, notice, invoice, or activation date while correctly crossing month and year boundaries.
FAQ
Can I subtract days as well as add them?
Yes. Enter a negative integer for days to move backward, a positive integer to move forward, or zero to keep the same date.
Does the calculation handle leap years?
Yes. It applies Gregorian rules, including the century exception: years divisible by 100 are common years unless they are also divisible by 400.
What date format is accepted?
Use strict YYYY-MM-DD format, such as 2026-08-06. The month and day must use two digits, and the date must exist.
Are weekends and holidays skipped?
No. This capability counts calendar days, including every weekend and holiday. Use a business-day calculator when non-working days must be excluded.
What happens if the starting date is invalid?
Impossible dates such as 2023-02-29 or 2026-04-31 are never normalized into another month.
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/math/add-subtract-days \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"date":"2024-12-28","days":5}'const res = await fetch("https://api.kit.forhosting.com/math/add-subtract-days", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"date": "2024-12-28",
"days": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/add-subtract-days",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"date": "2024-12-28",
"days": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/add-subtract-days", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"date":"2024-12-28","days":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"date":"2024-12-28","days":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/add-subtract-days", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"date": "2024-12-28",
"days": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.add_subtract_days",
"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.
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
Invalid dates are rejected clearly instead of being silently normalized, making the result suitable for schedules, billing rules, data pipelines, tests, and repeatable API automation.
How rollover and leap years are calculated
Identical JSON input therefore produces identical JSON output regardless of where or when it runs, including around leap days and year boundaries.
Use the result safely in real workflows
A successful response returns the normalized starting date, the signed number of days applied, and the resulting ISO date. Validate upstream data rather than depending on normalization: an impossible starting date produces an invalid_input error, which lets an integration stop and correct the record. Browser use is free, while successful API execution uses the displayed base price of $0.002 per request.
Integration use cases
Move dates backward for cutoffs
Use a negative day count to derive retention cutoffs, reporting windows, reminder starts, or historical comparison dates from a known endpoint.
Create deterministic test fixtures
Generate expected ISO dates for leap-year and rollover tests without depending on the host clock, locale, time zone, or daylight-saving rules.
Technical questions
What does the API request cost?
The browser calculator is free. A successful API request uses the published base price of $0.002.