german, calendar, motto, heart, way of thinking, cards, subtitles, date, to read, planning, priority, symbol, comments, to remind, paper, the calendar, broken, wooden heart, sheet, messages, caution, saying, poetry, cool wallpapers, priority, priority, priority, priority, priority, poetry. Days between dates: the method a calculator runs and the divide by seven check
Photo by pasja1000 on Pixabay

Maintenance

Part of Days between dates: six honest answers to one simple-looking pair

Days between dates: the method a calculator runs and the divide by seven check

The method a days between dates calculator runs, written for paper: day of year subtraction, leap years, a divide by seven check, and when to trust a tool.

There is no calculator on this page. What there is instead is the method a calculator runs, written out so you can run it on paper, and the two checks that tell you whether a calculator's answer is right without running it again.

Both are short. The method needs a table of month lengths and subtraction. The checks need division by seven.

What to take away

  • Turn each date into its day-of-year, subtract, and add 365 or 366 for each year boundary crossed. That is the entire calculation for calendar days.
  • Every result can be checked in secondsthe remainder on division by seven must match the weekday shift between the two dates.
  • Working days are the calendar count minus the rest days and closures inside it, and the closures come from a publisher this page does not stand in for.

What a calculator asks, and what each input changes

What a calculator asks

InputWhat it changes
The two datesEverything, obviously, but note which is earlier; some tools return a negative if you swap them, some silently swap back
Include the end dateAdds one to the exclusive count
Include the start dateThe same one, from the other side; ticking both adds one, not two
Count working daysRemoves rest days; needs a working week
ClosuresRemoves those that fall on working days; needs a list, which is yours to supply
ZoneOnly matters if the inputs are moments rather than dates

A calculator that does not show these inputs is applying defaults you cannot see. Read its result as "the exclusive calendar count, probably".

Calculator inputs and effects

Input

Two dates
Everything; order matters
Include end date
Adds one
Include start date
Adds one, not two
Count working days
Removes rest days
Closures
Removes working-day closures
Zone
Only for moments

What it changes

Two dates
Include end date
Include start date
Count working days
Closures
Zone

The method for calendar days

Cumulative days before each month, in a common year: January 0, February 31, March 59, April 90, May 120, June 151, July 181, August 212, September 243, October 273, November 304, December 334. In a leap year add one to every entry from March onward.

Day-of-year method

  1. Find cumulative days before month
  2. Add day of month for day-of-year
  3. Same yearsubtract day-of-year
  4. Across yeardays left + whole years + day-of-year
  5. Leap yearadd one from March onward

Same year. Day-of-year of each date is the cumulative figure plus the day of the month. Subtract.

10 February 2027 is 31 + 10, day 41. 23 November 2027 is 304 + 23, day 327. The difference is 286 calendar days, exclusive of the start. Inclusive of both, 287.

Across a year boundary. Days left in the first year, plus 365 or 366 for each whole year in between, plus the day-of-year of the second date.

20 December 2026 is day 354 of a 365-day year, so 11 days remain. 10 January 2027 is day 10. No whole years between. 11 + 10 gives 21.

Leap years. A year divisible by four has 366 days, unless it is divisible by 100 and not by 400. The extra day sits at the end of February, which is why every date from 1 March on in a leap year is one day further into the year than in a common year: 1 February 2028 to 1 March 2028 is 29 days, where the same span in 2027 is 28.

The check that catches almost everything

Any calendar-day count, divided by seven, leaves a remainder between 0 and 6. That remainder is the number of weekdays the later date has shifted from the earlier one.

Remainder check

286 ÷ 7 = 40 r6

r6 = later date shifts 6 weekdays

10 Feb 2027: Wednesday

23 Nov 2027: Tuesday

286 divided by 7 is 40 remainder 6. 10 February 2027 is a Wednesday. Six weekdays on from Wednesday is Tuesday, and 23 November 2027 is a Tuesday. The count is consistent. Had the count been 285, the remainder would have been 5 and the later date would have needed to be a Monday, which it is not.

This check needs the weekday of both dates. A printed calendar gives it, as does any spreadsheet's TEXT(date, "dddd"), and you can compute it with Zeller's congruence, a short formula that returns the weekday of any Gregorian date.

The check catches off-by-one errors, dropped leap days and transposed months, which are nearly every error a hand count makes.

From calendar days to working days

Take the exclusive calendar count and split it into whole weeks and a remainder. Each whole week holds five working days on a Monday-to-Friday calendar. Walk the remainder days one by one, starting the day after the start date, and count those that are not rest days.

Working-day count

  1. Split calendar days into weeks and remainder
  2. Each whole week gives five working days
  3. Walk remainder days from day after start
  4. Count non-rest days
  5. Subtract closures on working days

286 days is 40 weeks and 6 days. Forty weeks give 200. The six remainder days after Wednesday 10 February run Thursday to Tuesday and hold four working days. Total, start excluded, 204. Include the start day as well and it is 205.

Then subtract every closure that falls on a working day inside the span. The list of closures belongs to whoever set the deadline and this site publishes none; how the phrase "business day" hides that choice is set out under adding business days.

When to trust a calculator

When it shows its inputs, when its calendar-day result passes the remainder check, and when it tells you which closure list and which version it applied. The seven inputs that expose a tool apply to a between-dates tool as much as to a subtraction one.

Trust tests for a calculator

  • Shows its inputs
  • Calendar result passes remainder check
  • Tells closure list and version
  • Fails third testunknown vintage

A tool that fails the third test is giving you a working-day count against a list of unknown vintage. For a count that runs backwards from a fixed date, where a wrong closure costs a day you thought you had, that is the whole risk.

The endpoint conventions that turn 286 into 287 or 285, and the six readings one pair of dates can carry, are under counting between two dates. Where the method has to run in a sheet or a service rather than on paper, the contract between the two keeps the answers identical.

Common questions

Do I add one or not?

Subtraction gives the exclusive count. If the rule you are counting under says both days are in, add one. If it says neither is, subtract one. Never add one for each end.

The two dates are in different zones. Which day-of-year do I use?

Convert both moments to the zone that governs, read the date off each, then count. Without a governing zone the question has two answers.

How do I count across several years quickly?

Days left in the first year, plus 365 for each whole year between, plus one for each leap year among them, plus the day-of-year of the last date. The remainder check still applies at the end.

Is the remainder check independent of the calendar system?

It depends on the seven-day week rather than on the calendar, so it holds under the Gregorian calendar and would hold under any other calendar keeping the same weekly cycle. Leap days do not disturb it, because a leap day is one more day in the count like any other.

Is the remainder check enough on its own?

It catches errors that change the count by anything not divisible by seven. An error of exactly seven passes it. That is why the method is short enough to run twice.

More in Maintenance

Latest from Market Desk