CodeKitHub中文

Date Calculator

Calculate the exact number of days, weeks and months between two dates, or add and subtract time from a date to find a deadline or anniversary. Everything runs locally in your browser — no dates are ever uploaded.

What Is This Tool?

A date calculator answers two everyday questions: "how much time is between these two dates" and "what date is N days/weeks/months from now." This tool covers both in one place — a difference mode that gives you the exact gap in days, weeks and calendar years/months/days, and an add/subtract mode that projects a date forward or backward.

The math accounts for real calendar irregularities: months of different lengths, leap years, and the fact that "3 months from January 31" has to land on a real date. It does not account for time zones or business-day rules (weekends and holidays are counted as normal days) — if you need working-day-only calculations, treat this as a starting point and subtract weekends/holidays manually.

Why Use It?

  • Get the exact day count between two dates for contracts, invoices, project deadlines or age-related eligibility rules.
  • Add or subtract days, weeks, months or years from any date — useful for due dates, warranty expirations, or "90 days from delivery" clauses.
  • See both the raw day count and the calendar breakdown (years/months/days) for the same gap — useful when a form asks for one but you're thinking in the other.
  • 100% private: all date math happens in your browser, nothing is sent to a server.
  • No login, no ads blocking the tool, works on mobile.

How to Use

  1. Choose "Days between two dates" to measure a gap, or "Add/subtract days from a date" to project forward or backward.
  2. For a gap: pick a start and end date (order doesn't matter, the tool sorts them automatically) and click Calculate.
  3. For add/subtract: pick a base date, a direction, an amount, and a unit (days, weeks, months or years), then click Calculate.
  4. Read the result — the difference mode shows total days plus the years/months/days breakdown; the add/subtract mode shows the resulting date and its weekday.

Example

Input

Start: 2026-01-15, End: 2026-07-10

Output

176 days — exactly 5 months, 25 days

The total-days figure and the calendar breakdown describe the same gap in two different units; use whichever your form or contract asks for.

Practical tips

  • Contracts and invoices that say "net 30" or "due within 90 days" almost always mean calendar days, not business days — use the add/subtract mode with the invoice date as the base to get the exact due date.
  • When a form asks for age or tenure "as of" a specific date rather than today, use the difference mode with that specific date as the end date instead of relying on today's date.
  • The years/months/days breakdown is calendar-aware (it respects actual month lengths), while total days is a fixed count — use total days for anything measured in a flat rate (e.g. daily storage fees), and the breakdown for anything phrased in human terms (e.g. "how old is this warranty").

Common scenarios

Deadline tracking: given a delivery or filing date and a "within N days" rule, add/subtract mode gives the exact due date including weekday, so you can immediately see if it lands on a weekend.

Age or tenure at a fixed date: instead of today's age, HR forms and eligibility rules sometimes need age or service length as of a specific cutoff date — use difference mode with that cutoff as the end date rather than the age calculator, which always measures to today.

Age Calculator · Timestamp Converter

Frequently Asked Questions

Does this count weekends and holidays as full days?

Yes — both modes use plain calendar days. If you need business-day-only counts (excluding weekends and public holidays), use the total day count from this tool and subtract the non-working days for your specific calendar.

Why does adding 1 month to January 31 give a different result than expected?

Not every month has 31 days. Adding 1 month to January 31 lands on March 2 (or a similar overflow date) in this tool, because JavaScript's date math rolls the extra days into the next month rather than clamping to the last day. If you need clamped behavior (January 31 + 1 month = February 28/29), adjust the result manually.

Does the tool account for leap years?

Yes. Leap years are handled automatically because the calculation uses native JavaScript Date objects, which already know February has 29 days in a leap year.

Which date should I enter as "start" and which as "end"?

It doesn't matter — the difference mode automatically sorts the two dates before calculating, so entering them in either order gives the same result.

Is there a limit on how far apart the two dates can be?

No practical limit — the tool works correctly for dates decades or centuries apart, since it uses standard JavaScript date arithmetic rather than a lookup table.

Related Tools