How many days lie between two dates

History and time

New Year's Days from 1600 to 2000, read downward: how far the calendar stands ahead of its mean year. A leap day pushes it right and plain years let it drift back. Sepia marks 1700, 1800 and 1900, which drop the leap day. In 2000 it is back where it began.

A proleptic Gregorian date in the years 1600 through 2400 becomes an integer day count, and the elapsed days are the difference. An uncertainty widens each date by that many days and reports the possible differences. A ranged date runs from its earliest to its latest possible day, and the days between two ranged dates run from the fewest to the most. The source label is text. It is not fetched, and it is not a biography.

Six day cells from 23 to 28 October 2026 with a bracket spanning five days between the two dates.
The default dates, 23 and 28 October 2026, shaded at each end of a strip of six days. The bracket runs from one date to the other: 5 days elapsed, with no uncertainty on either date.

Years run from 1600 to 2400. Uncertainty is 0 to 7 days. The label is 1 to 80 characters and is not looked up.

Each line is the earliest day, the latest day, then a source label of 1 to 40 characters. An exact day may give one date. Up to six lines, read in the order typed.

The result appears here when the page script runs.

How it is computed

Method

The day count follows the civil integer recurrence opened on Howard Hinnant's page on 28 October 2026: shift the year when the month is January or February, then combine the 400-year era, the day of the year, and the offset 719468. The inverse recovers the date. Elapsed days are the second serial minus the first. With uncertainties u and v, the possible differences run from (second minus u) minus (first plus v) through (second plus u) minus (first minus v).

Ranged dates

Each ranged line becomes the serial of its earliest day and of its latest day, by the same recurrence, and spans latest minus earliest plus one days. From one line to the next, the fewest days are the next earliest minus this latest, and the most are the next latest minus this earliest; every whole number between them can occur. When the fewest is above zero the next line is later, when the most is below zero it is earlier, and otherwise the order is not settled. The uncertainty on the two dates above is the same case, with the date less and plus its uncertainty as earliest and latest.

Assumptions

Years stay in 1600 through 2400 so the round trip is inside the tested range. A day that is not in the month is refused. Leap days follow the Gregorian rule, including the century exception.

Limits

The label is not a source that was opened, except that the algorithm page itself was opened for the method. The dates are not events in a life.

Reproducibility

The inputs are kept in the address bar, so the same link reruns the same calculation.