ForHosting KIT · Dates & time

Subtract weeks from a date

Enter a date and a number of weeks to find the exact earlier day: 18 March 2024 minus 3 weeks, or 21 days, is 26 February 2024. Each week is seven days, so the weekday never changes. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Date
2024-03-18
Weeks
3
You get
Result
2024-02-26
Days subtracted
21
Year
2,024
Month
2

This subtract-weeks-from-a-date calculator accepts an explicit Gregorian date in strict YYYY-MM-DD form and a non-negative whole number of weeks, then returns the exact earlier date. Every week is defined as seven consecutive calendar days, so the weekday stays the same while month, year, and leap-day boundaries are handled correctly.

What subtracting whole weeks means

Subtracting a whole week means moving exactly seven calendar days backward from the supplied base date. Two weeks means fourteen days, fifty-two weeks means 364 days, and zero weeks leaves the date unchanged. Because every accepted amount is multiplied by seven, the resulting date falls on the same weekday as the base, even when the calculation crosses a short month, leap day, or year boundary.

This is calendar arithmetic rather than business-calendar arithmetic: Saturdays, Sundays, public holidays, office closures, and regional observances all count as ordinary days. Supply date as four-digit year, two-digit month, and two-digit day separated by hyphens, together with weeks as a non-negative integer. Invalid dates such as 2023-02-29, incomplete values, decimal week counts, negative counts, and results before year 0001 are rejected instead of being silently adjusted.

The calculation never interprets the input as a timestamp, so midnight offsets and daylight-saving changes cannot move the result to an adjacent day.

How the deterministic calendar algorithm works

The engine first checks the input against strict YYYY-MM-DD syntax and validates the actual Gregorian month length. February receives twenty-nine days only when its year is divisible by four, except century years must also be divisible by four hundred. It then validates weeks as a whole number within the published limit and multiplies it by seven using safe integer arithmetic.

Instead of constructing a JavaScript Date, the algorithm maps the validated year, month, and day to a serial day number in the proleptic Gregorian calendar. It subtracts the exact day total and performs the inverse mapping to recover the earlier civil date. This method treats the Gregorian rules consistently throughout the supported years and avoids implementation-dependent date parsing.

Practical uses and important boundaries

A Monday moved backward by any accepted whole-week count remains a Monday under the same civil calendar, which makes weekly schedules easier to reason about than an approximate month subtraction. The tool intentionally does not answer every date question. It does not subtract working weeks, skip holidays, parse phrases such as next Friday, convert timestamps, infer a missing year, or use today as an implicit base.

If a policy says business days, months, quarters, or a timezone-aware duration, choose a calculator designed for that unit because those operations have different boundary rules. For an interactive check, the browser performs the same pure calculation locally. Since the base date is explicit and the engine has no current-time input, saved examples and repeated jobs remain reproducible long after they were first created.

Plan a weekly program

Find the start date a whole number of weeks before a fixed event while preserving its weekday.

Build reporting windows

Calculate a stable earlier boundary for reports and cohorts defined in exact seven-day periods.

What does the calculator cost?

It is free to run in the browser.

How many days are in each subtracted week?

Exactly seven consecutive calendar days. Weekends and holidays are included.

Will the resulting date have the same weekday?

Yes. Subtracting any whole multiple of seven days preserves the weekday in the Gregorian calendar.

Does it use today's date or my timezone?

No. You must provide the base date explicitly, and the calculation uses neither current time nor timezone data.

Which inputs are rejected?

Malformed or impossible dates, negative or fractional week counts, counts above the published limit, and results outside years 0001 through 9999 are rejected.

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.

POSThttps://api.kit.forhosting.com/date/subtract-weeks

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.

curl -X POST https://api.kit.forhosting.com/date/subtract-weeks \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"date":"2024-03-18","weeks":3}'
{
  "date": "2024-03-18",
  "weeks": 3
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "date.subtract_weeks",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

year_min1
year_max9999
weeks_min0
weeks_max521775
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Run it interactively in your browser, or use the API for $0.002 per successful request when a workflow needs a repeatable result.

What subtracting whole weeks means

The response echoes the normalized date and weeks, reports days_subtracted, and provides result plus separate year, month, and day fields for convenient downstream use.

How the deterministic calendar algorithm works

No current-time value is consulted, no timezone is selected, and no remote calendar service participates, so identical inputs always produce identical JSON. That reproducibility matters in tests, financial cutoffs, scheduled content, and audit records where a result must remain stable regardless of where or when the request runs. The endpoint accepts documented aliases for integration convenience, but aliases do not change validation or arithmetic. If the subtraction would move beyond the supported year range, the request returns invalid_input rather than wrapping or inventing a year zero.

Practical uses and important boundaries

For automation, each successful API request costs $0.002 and returns structured fields suited to scripts, spreadsheets, test suites, and workflow steps.

Create calendar test fixtures

Generate deterministic expected dates across month, year, and leap-day boundaries without using the system clock.

Read the full KIT documentation →