CalcPerks
Date & Time

Date Difference Calculator

Count the days, weeks and months between two dates.

Choose a start and end date to see the full duration between them in days, weeks, months and years.

Choose two valid dates to see the duration.

How to use this calculator#

  1. Put the earlier date firstThe tool handles a reversed range, but reading the result is easier when the sign is positive. For a duration that spans a leap day, check that 29 February is inside your range — it changes the total by one.
  2. Decide inclusive or exclusive before you quote the numberThe result is the number of full days between the two dates. Add one if both bookends count, which is how notice periods, hotel stays counted in nights versus days, and ‘within 30 days including today’ clauses usually work.
  3. Use the years-months-days breakdown for long spans‘4 months 18 days’ communicates better than 138 days. The breakdown counts whole calendar months, so it never assumes a month is 30 days.
  4. Use total days for anything you need to divideSplitting work across a period, calculating a daily rate or pro-rating a charge all need the raw day count. Months of unequal length make the calendar breakdown useless for arithmetic.

The formula#

Elapsed and inclusive day counts

Elapsed days = ordinal(End) − ordinal(Start) • Inclusive days = Elapsed days + 1 • Weeks = ⌊Elapsed ÷ 7⌋ with the remainder as loose days

Start
The earlier calendar date
End
The later calendar date
ordinal(d)
A serial day number for date d — day-of-year within one year, or a Julian day number across years. The difference is what matters, not the origin
Elapsed days
The exclusive count: midnights crossed between Start and End. Start-to-Start is 0
Inclusive days
The count with both bookends included, one greater than elapsed

Elapsed counting is the default here and in almost every spreadsheet: subtracting one date from another in Excel or Google Sheets returns the exclusive figure. Legal and commercial texts vary — ‘within 30 days’ usually excludes the trigger day and includes the deadline day, while ‘30 clear days’ excludes both. Leap years need no adjustment because the count runs over real calendar dates, so a range containing 29 February is automatically one day longer.

Counting time between dates#

The difference between two dates can be expressed several ways at once: total days is the simplest, while a years-months-days breakdown is more human-friendly for long spans.

Worked examples#

A project window measured three ways

12 February 2026 to 30 June 2026.

  1. Day-of-year for 12 February = 31 + 12 = 43
  2. Day-of-year for 30 June = 151 + 30 = 181
  3. 181 − 43 = 138 elapsed days; 139 if both dates count
  4. 138 ÷ 7 = 19 weeks with 5 days left over
  5. Calendar breakdown: 12 Feb → 12 Jun is 4 whole months, then 12 Jun → 30 Jun is 18 days

138 days (139 inclusive) — 19 weeks 5 days, or 4 months 18 days.

The same two months, one day apart

1 January to 1 March, in 2027 and again in 2028.

  1. 2027: January contributes 31 days and February 28 → 31 + 28 = 59 days
  2. 2028: January contributes 31 and February 29 → 31 + 29 = 60 days
  3. 2028 is divisible by 4 and is not a century year, so it is a leap year
  4. 2100 is divisible by 100 but not by 400, so it will be a common year

59 days in 2027 and 60 in 2028. Any calculation that hard-codes 365 days a year drifts by one day for every leap year it crosses.

Reference tables#

Days in each month and cumulative day-of-year‘Days before’ is the running total to add to a day number to get the day-of-year.
MonthDaysDays before it (common year)Days before it (leap year)
January3100
February28 (29 in a leap year)3131
March315960
April309091
May31120121
June30151152
July31181182
August31212213
September30243244
October31273274
November30304305
December31334335

Example: 4 August is 212 + 4 = day 216 of a common year, and 25 December is 334 + 25 = day 359. Subtracting gives 143 days between them without touching a calendar.

Common durations in daysExact where the unit is fixed, and a range where the calendar decides.
DurationDaysNotes
1 week7Always exactly 7
2 weeks (a fortnight)14Always exactly 14
1 month28 to 31Never a fixed number — use calendar months, not 30-day blocks
30 days30Roughly a month, and the basis of Net 30 payment terms
1 quarter90 to 92Q1 is 90 days in a common year, 91 in a leap year
90 days90Between 2 months 28 days and 3 months 1 day, depending on the start date
6 months181 to 184The exact figure depends on which half of the year
1 year365 or 366366 whenever the span contains a 29 February
18 months546 to 550
2 years730 or 731
5 years1,826 or 1,8271 Jan 2026 to 1 Jan 2031 is 1,826 days, containing one leap day
10 years3,652 or 3,653

Anything above a month is a range, not a constant. Quote the exact dates alongside the day count whenever the difference could matter.

Common mistakes#

  • The off-by-one on inclusive counting‘Five working days from Monday to Friday’ is five days inclusive but four elapsed. Spreadsheets return the elapsed figure, most contracts mean the inclusive one, and the gap of a single day is enough to miss a filing deadline or over-bill a hotel stay by a night.
  • Dividing days by 30 to get months138 ÷ 30 = 4.6 months, but the real answer is 4 months 18 days — and 18 days is more than half of some months and less than half of others. Only whole calendar months make sense as a unit, and they have to be counted, not derived.
  • Assuming every day has 24 hoursIn regions that observe daylight saving, one day each spring has 23 hours and one each autumn has 25. Computing a date difference in milliseconds and dividing by 86,400,000 can therefore return 29.96 or 30.04 days instead of 30, which truncates to the wrong integer.
  • Letting a time zone shift the endpointsParsing ‘2026-03-14’ as a UTC instant and rendering it in a US time zone shows 13 March. Do that at both ends and the difference can come out a day short. Treat date-only values as calendar dates with no time component.

Frequently asked questions#

Is the end date included?

The result is the number of full days between the two dates. Add one if you need to count both the start and end day inclusively.

Can I use it for future dates?

Yes — put any future date as the end date to count down to it.

Key terms#

Elapsed (exclusive) days
The number of midnights crossed between two dates. What subtracting dates in a spreadsheet returns.
Inclusive days
Elapsed days plus one, counting both the first and last day. The convention behind most contractual day counts.
Clear days
A legal term excluding both the first and the last day, so ‘seven clear days’ notice means nine calendar days from notice to event.
Day-of-year (ordinal date)
The position of a date within its year, 1 to 365 or 366. 1 March is day 60 in a common year and day 61 in a leap year.
Julian day number
A continuous count of days used in astronomy and by date libraries, which makes differences across years a simple subtraction.
ISO 8601
The international date standard, YYYY-MM-DD, plus a duration syntax such as P4M18D for four months and eighteen days.

Sources#

  1. ISO 8601 date and time formatInternational Organization for Standardization
  2. RFC 3339 — Date and Time on the Internet: TimestampsIETF
  3. Daylight saving time and civil timekeepingNIST Time and Frequency Division

Figures last checked .

Put this calculator on your site

Free, no sign-up, and no attribution fee — just keep the credit line that comes with the code. The calculator stays up to date automatically.

Preview the embed →