Days Between Dates — Calculate Days, Weeks, Months Between Two Dates
Pick a start and end date and the page tells you exactly how many days lie between them, with toggleable inclusive (end-date counted) vs exclusive (end-date not counted) semantics — the choice that matters when settling things like vacation day counts, hotel night invoices (always exclusive), rental contract lengths, or interest accrual periods. Also surfaces the same duration in weeks (with remaining days), approximate months, approximate years, and total hours and minutes for short-range precision. Useful for accurate vacation accounting, project deadline math, contract duration verification, days-since-event tracking, or just settling "how many days has it actually been since X".
About this tool
Both dates are parsed as UTC midnight to keep daylight-saving transitions from adding or subtracting a day at the boundary. Total days = `Math.floor((end - start) / 86_400_000)`, and the inclusive toggle adds 1 — that single bit is worth thinking about: hotels charge per night (exclusive — a Mon-Wed booking is 2 nights), most legal contracts count both endpoints (inclusive — a Mon-Wed contract is 3 days), vacation policies vary (check yours). Weeks = floor of days/7, with the remaining days shown alongside. Approximate months use 30.4375 days (= 365.25/12, the Julian-year approximation); approximate years use 365.25 (Julian; Gregorian-exact = 365.2425 days per the 1582 Inter gravissimas reform, drift ~11 minutes/year, negligible for typical date math) — both useful for ballpark thinking but you should rely on the dedicated age calculator for legal year-and-month precision. Hours = days × 24 (because the UTC parsing sidesteps DST), minutes = hours × 60. Past dates are handled with `Math.abs` so flipping the inputs gives the same magnitude. Common uses: hotel-night auditing (always exclusive), vacation-day verification (depends on policy), legal-period counting (often inclusive), project-cycle reporting, days-since milestones, gestation tracking, sentence-served calculation.
- Days between two dates with inclusive/exclusive end-date toggle
- Plus weeks (with remaining days), approximate months, approximate years
- Total hours and minutes for short-range precision
- UTC midnight parsing — DST transitions don't add/subtract a day
- Math.abs lets you flip start/end without changing magnitude
- Inclusive toggle aligns with legal vs hotel-night vs vacation conventions
- Live recalc as you change either date
- Approximate months at 30.4375-day Gregorian average
- No upload — both dates stay in your browser
- Useful for hotel nights, vacation days, contracts, project cycles
Free. No signup. Your inputs stay in your browser. Ads via Google AdSense (consent required).
Frequently asked questions
Why do hotel nights count differently from contract days?
Hotel-night counts are exclusive of the check-out day: a Mon→Wed booking (check-in Mon, check-out Wed) is 2 nights (Mon night + Tue night, leaving Wed morning). Contract durations and many legal periods are inclusive of both endpoints — a Mon→Wed contract is 3 days by inclusive-counting convention common in legal contracts (both endpoints counted). Vacation policies vary: some workplaces count both endpoints (5 working days for a Mon→Fri vacation), others count only working days (excluding weekends within the range), others exclude the return day. The toggle in this tool defaults to exclusive (matching hotel-night convention) and adds 1 if you switch to inclusive. Common gotchas: rental contracts often mix conventions (rent days = inclusive, security-deposit return = exclusive); insurance policies count from effective date inclusive to expiry date exclusive; mortgages accrue interest differently across jurisdictions.
Why use UTC midnight parsing instead of local time?
Daylight-saving transitions can add or subtract a day at the boundary if you compute durations in local time. EU spring-forward (last Sunday of March, +1 hour) makes clocks jump from 01:00 to 03:00 in CET, so a "1-day duration" computed as local-time difference can come out to 23 hours instead of 24; autumn fall-back gives 25 hours. UK DST follows the same EU pattern; US DST runs on different Sundays (second Sunday of March, first Sunday of November). Southern-hemisphere dates run reverse (Australian DST starts October, ends April). Parsing both dates as UTC midnight (00:00:00Z) sidesteps all of this — the difference in milliseconds is exactly `days × 86,400,000` regardless of which calendar dates fall in DST. The trade-off: if you actually care about wall-clock time across DST (counting how many actual business hours), you have to add the boundary correction back manually.
How accurate is the "30.4375 days/month" approximation?
30.4375 days = 365.25/12, which is the Julian-year average month length. The Gregorian-exact value is 365.2425/12 = 30.436875 days/month — a difference of 0.000625 days (~54 seconds) per month, accumulating ~0.5 hour per year. For ballpark date thinking ("about 6 months from now") the difference is invisible. For multi-year mortgage amortisation, actuarial work, or academic research, you should use Gregorian-exact 365.2425 with explicit leap-year handling, or a calendar-aware library (Temporal API, date-fns, Luxon, day.js as the modern successor to deprecated Moment.js). The tool's "approximate months" output suits project-scope estimation and human-conversation context; for legal/financial precision spanning multiple years, use the dedicated age calculator which does year-and-month math explicitly with calendar-aware clamping.
Why is ISO 8601 the only date format I should use programmatically?
ISO 8601:2019 (the YYYY-MM-DD format) meets two critical properties simultaneously: it's locale-unambiguous (the US 02/03 = February 3, the EU 02/03 = March 2 — never the same conversation in ISO), and it's lex-sortable as a plain string (so "2024-12-31" < "2025-01-01" gives the correct chronological order without parsing). RFC 3339 (Klyne & Newman 2002) is the IETF profile of ISO 8601 used throughout the web stack: HTTP Date headers, JSON Schema date format, OpenAPI specifications, JWT iat/exp claims, structured log timestamps, RSS/Atom feed dates, ISO database TIMESTAMP columns, JavaScript's Date.prototype.toISOString(). When you write any date to a file, log, or API payload, use ISO 8601. Localised display formats (12/31/2024, 31.12.2024, 31 dic 2024) belong only in user-facing UI rendered just before display.
Why does JavaScript Date use the Unix epoch 1970-01-01?
The Unix epoch 1970-01-01T00:00:00Z (midnight UTC, January 1, 1970) is the reference time origin for the POSIX time_t standard (IEEE Std 1003.1, current revision 1003.1-2024), which Linux, macOS, BSD, and most Unix-like systems use as their internal clock representation. JavaScript inherited the convention from Java in 1995 and codified it in ECMA-262 §21.4: a Date object's internal value is the number of milliseconds since the epoch, stored as an IEEE-754 double-precision float. The double-precision range gives ±100,000,000 days ≈ ±273,790 years from the epoch, with millisecond precision (±0.5–1 ms). The epoch was chosen partly arbitrarily (the original Unix system clock at Bell Labs was 1971; the round-down to 1970-01-01 was ergonomic) and has stuck because the alternative — re-anchoring to a different epoch — would break decades of stored timestamps in databases, log files, and protocols.
Sources (6)
- International Organization for Standardization (2019). ISO 8601-1:2019 + ISO 8601-2:2019 — Date and time — Representations for information interchange (current edition revising ISO 8601:2004); canonical YYYY-MM-DD format, week-numbering, ordinal-date, time-zone designators. ISO Technical Committee 154 (TC 154); supersedes ISO 8601:2004.
- Klyne, G., & Newman, C. (2002). RFC 3339 — Date and Time on the Internet: Timestamps (IETF profile of ISO 8601 mandated for HTTP Date headers, JSON Schema, OpenAPI, JWT iat/exp, structured logs). Internet Engineering Task Force, Request for Comments 3339, July 2002 (Proposed Standard).
- Ecma International (2024). ECMA-262, 15th edition (June 2024) — ECMAScript Language Specification §21.4 Date Objects: time value as ms since Unix epoch 1970-01-01 UTC, IEEE-754 double precision (range ±100,000,000 days ≈ ±273,790 years from epoch); §21.4.4.25 Date.prototype.setMonth overflow semantics. Ecma International TC39; current standard ECMA-262 published annually since ES5 (2011); Temporal API at TC39 Stage 3 (2026) provides explicit-clamping alternative.
- Pope Gregory XIII (1582). Papal bull Inter gravissimas (24 February 1582) — Gregorian calendar reform: leap year rule (year ÷ 4 AND (not ÷ 100 OR ÷ 400)); 10-day skip 4-15 October 1582 to realign vernal equinox; Gregorian mean tropical year = 365.2425 days (vs Julian 365.25, drift ~11 min/year). Papal States; adopted by Catholic Europe 1582-1584, Protestant nations gradually 1700-1923 (Britain 1752, Russia 1918, Greece 1923).
- IEEE / The Open Group (2018). POSIX.1-2017 (IEEE Std 1003.1-2017) — defines time_t as seconds since the Unix epoch 1970-01-01T00:00:00Z (UTC); the canonical reference epoch for JavaScript Date, Linux/Unix system clocks, RFC 3339 'Z' UTC designator. Institute of Electrical and Electronics Engineers / The Open Group joint standard (current revision IEEE Std 1003.1-2024).
- World Wide Web Consortium (W3C) (2018). Web Content Accessibility Guidelines (WCAG) 2.1 — Success Criterion 4.1.3 Status Messages. W3C Recommendation 5 June 2018; carried unchanged into WCAG 2.2 (Recommendation 5 October 2023).
These are the original publications the formulas in this tool are based on. Locate them by journal name and year on Google Scholar or PubMed.