Date Calculator→Specialized Version
📅

Days Between Dates Calculator

Days between dates

90
Days
12
Weeks
2
Months
0
Years
64
Business days

Days Between Dates Calculator

Calculate the number of days between any two dates. Essential for project planning, age calculations, and countdown tracking.

Date Difference Examples

Start DateEnd DateDays
Jan 1Dec 31364
Jan 1Jan 3130
BirthdayTodayYour age in days

Implementation

``javascript function daysBetween(date1, date2) { const oneDay = 24 * 60 * 60 * 1000; const d1 = new Date(date1); const d2 = new Date(date2); return Math.round(Math.abs((d2 - d1) / oneDay)); } `

Including vs Excluding End Date

Some calculations include both start and end dates (inclusive), while others exclude one. Our calculator shows both counts clearly.

Measuring the Gap Between Two Dates

Two dates can be "one day apart" in several different senses, and the one you want depends on the question:

Measure2026-03-01 to 2026-03-02
Calendar days between1
Days inclusive of both ends2
24-hour periods elapsed1, or 0.958 across a spring DST change
Business days1, unless one is a weekend
The inclusive/exclusive distinction is where most off-by-one bugs live. "How many days is the conference" (inclusive) and "how many days until the conference" (exclusive) differ by one, and both phrasings appear in the same requirements document.

`javascript // Calendar days, DST-safe: compare at UTC midnight const daysBetween = (a, b) => { const utc = (d) => Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()); return Math.round((utc(b) - utc(a)) / 86400000); }; `

Normalising to UTC midnight before subtracting removes both the DST problem and any time-of-day component, which is almost always what "days between" is meant to mean.

The Traps in Date Arithmetic

Months are not 30 days. Adding one month to 31 January has no correct answer, and every library picks differently — 28 February, 2 March or an error. Decide which your business needs before the edge case decides for you.

Days are not always 86,400 seconds. Daylight saving makes one day 23 hours and another 25. Adding n * 86400000 milliseconds drifts by an hour twice a year, which is enough to move a date across midnight and return an answer one day out.

`javascript // Correct — the Date object normalises overflow and handles DST const addDays = (date, days) => { const result = new Date(date); result.setDate(result.getDate() + days); return result; };

// Correct — calendar days, unaffected by DST or time of day const daysBetween = (a, b) => { const utc = (d) => Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()); return Math.round((utc(b) - utc(a)) / 86400000); }; `

Months are zero-indexed in JavaScript. new Date(2026, 0, 1) is January. new Date(2026, 12, 1) is January 2027, silently.

Parsing is not portable. new Date("2026-08-30") is parsed as UTC, while new Date("2026/08/30")` is parsed as local — the same calendar date, a day apart in some zones. Always parse ISO 8601, and construct with explicit components when the time matters.

Time Zones Decide the Answer

QuestionDepends on
How many days until an event?The viewer's zone
Is this subscription expired?UTC, always
What day of the week was this?The zone the event happened in
When does "tomorrow" start?The viewer's zone
Store timestamps in UTC and convert for display. Storing local times without an offset makes the data unrecoverable — you cannot tell later which zone it meant, and DST transitions make some local times ambiguous or non-existent.

Reference Points

IntervalDays
Week7
Month (average Gregorian)30.44
Quarter91.31
Year365.2425
Leap year366
The Gregorian rule — leap year every 4 years, except centuries, except every 400th — keeps the calendar within one day of the solar year for about 3,000 years.

Frequently Asked Questions

Does this include both start and end dates?

We show both options: "days between" excludes the end date (Jan 1 to Jan 3 = 2 days), while "days including both" counts both dates (Jan 1 to Jan 3 = 3 days). Choose based on your needs.

How do I calculate weeks between dates?

Divide the days by 7. Our calculator shows the result in multiple units: days, weeks, months, and years. 45 days = 6 weeks and 3 days.

Does this account for daylight saving time?

Yes, our calculator handles DST correctly. The calculation is based on calendar days, not hours, so DST transitions do not affect the day count.

Related Tools

Explore other tools you might find useful:

More Date Calculator tools

You might also need