Menu

Search toolsChangelog

to move to openDescribe the problem, not the tool

Days between two dates, counting both

Subtracting one date from another gives the number of nights, not the number of days: 1 June to 30 June is 29. Counting both ends gives 30, which is what a holiday booking, a hire agreement or a hotel bill means by thirty days. Turn on "count the end date as a day" and every figure on the page moves with it, including the working-day count.

The earlier date. The order does not matter — the tool reports the distance between the two.

The later date. By default it is the finishing line rather than a day that is counted.

Turn this on for a holiday or a hire: 1 to 5 June is five days when both ends count, four when they do not.

Days between
30
Whole calendar days, so a clock change never adds or removes one.
Business days
22
Weekend days and holidays
8
Weeks
4.29
Whole months
1
In years, months and days
1 month
Holidays skipped
0

Broken down by period

June 202630228

Results are provided as-is, with no warranty of accuracy. The method and its sources are published below so you can check the working.

Working days by period
Chart type for “Working days by period”
0 5 10 15 20 25 30 June 2026
0 5 10 15 20 25 30 June 2026
0 5 10 15 20 25 30 June 2026
0 5 10 15 20 25 30 June 2026
0 5 10 15 20 25 30 June 2026
0 5 10 15 20 25 30 June 2026

The span split into periods. The shorter bar is what is left once weekends and the holidays you listed are taken out.

What to take away
  1. Subtracting dates counts the gaps between days. Counting both ends counts the days themselves, and the two differ by exactly one.

  2. Car hire, hotel stays and annual leave nearly always count both ends; interest, notice periods and deadlines nearly always do not.

  3. June 2026 starts on a Monday, so counting both ends gives 30 days of which 22 are working days and 8 are weekend days.

How it works

The formula

Every date becomes a day number: whole days counted from 1970-01-01
in the proleptic Gregorian calendar. No hour, no offset, no clock.

  n = daysFromCivil(year, month, day)

The span is one half-open interval, [start, end):

  days = n(end) - n(start),  plus 1 if the end date is counted

Weekday of a day number, 0 = Sunday:

  w = ((n mod 7) + 4 + 7) mod 7        1970-01-01 was a Thursday

Business days over a span of N days beginning on weekday w0, without
walking the range:

  whole   = floor(N / 7)
  left    = N - 7 x whole
  working = whole x (7 - weekendDays)
          + how many of w0, w0+1, ..., w0+left-1 (mod 7) are worked
          - listed holidays inside the span that fall on a worked day

Calendar difference, where addMonths clamps to the end of the target
month (31 January + 1 month = 28 February):

  m     = the largest k with addMonths(start, k) <= end
  days  = n(end) - n(addMonths(start, m))
  years = floor(m / 12),  months = m mod 12

What it assumes

  • Dates are treated as days on a calendar, never as instants. There is no time of day anywhere in the arithmetic, so no timezone applies and the answer is the same in Auckland as it is in Anchorage.
  • Because there is no clock, a daylight-saving change cannot affect the count. A span across the March transition in Europe/London is 23 hours short of a whole number of 24-hour days, and dividing elapsed milliseconds by 86,400,000 would report one day fewer than the calendar shows.
  • By default the end date is the finishing line rather than a counted day, so 1 June to 30 June is 29. Turning on "count the end date as a day" makes it 30, and every figure on the page moves together.
  • The order of the two dates does not matter. The tool reports the distance between them and never a negative number.
  • Whole months are counted by clamped addition, so 31 January to 28 February is one whole month and 31 January to 1 March is one month and one day. Month arithmetic defined this way is not reversible — a month forward and then a month back from 31 January lands on 28 January.
  • A holiday falling on a weekend is not subtracted, because it was not a day that would have been worked. That is exactly why the United Kingdom observes Boxing Day on a Monday when 26 December is a Saturday, and why the substitute date is what the default list carries.
  • Every line in the holiday box that has no date on it is ignored rather than refused, because throwing an error would blank the page while somebody is halfway through pasting a list. The holidays-skipped figure is the check on that, since it counts the lines that actually applied.
  • The calendar is proleptic Gregorian throughout, including for dates before it was adopted. Britain switched in September 1752 and dropped eleven days doing it, so a span crossing that month is a day count and not what a contemporary diary would have said.

Common questions

Which convention do payroll and interest calculations use?

Almost always the exclusive one — the difference between the dates, counting neither end twice. A loan from 1 March to 1 April accrues 31 days of interest, not 32. Inclusive counting belongs to things measured in whole days of presence: hotel nights, holiday entitlement, notice periods.

Does the answer change if the dates are in different months?

No. The count is done on the underlying dates rather than by walking a calendar, so month lengths, leap days and month boundaries are all handled identically. 28 February to 1 March is one day in a common year and two in a leap year, and that is the only thing that differs.

Sources

Method written and checked by Tessalor on Jul 30, 2026.

The full method, worked example and every assumption behind this figure are on Date Difference Calculator.