CCalclabhub

Time & Dates

How To Calculate Days Between Dates

Counting the days between two dates, or adding a number of days to a date, is a calendar arithmetic problem. Both operations reduce to converting each date to a day number, doing simple addition, and converting the result back to a calendar date.

Quick Answer

Days between = day number of later date - day number of earlier date

From date
The starting date
To date
The ending date
Offset
Days to add to or subtract from the from date

From 1 January 2026 to 20 September 2026 is 262 days, or 37 whole weeks. Adding 30 days to 1 January 2026 lands on 31 January 2026, a Saturday.

What Is Days Between Dates?

Calendar arithmetic is awkward because months and years have irregular lengths. Counting days by hand means remembering which months have thirty-one days, which year is a leap year, and how the century rules work.

The reliable approach converts each date to a day number first. A day number is an integer that counts days from a fixed epoch, so the difference between two day numbers is exactly the number of days between the dates, with no special cases.

The standard day count is the Julian day number, used in astronomy since the sixteenth century. It is defined by a short formula that uses only integer division, so it can be evaluated exactly on a computer or by hand.

Converting a day number back to a calendar date is the inverse problem, and it has its own standard algorithm. It recovers the day, month and year in a few steps, again using nothing but integer division and subtraction.

The weekday comes almost for free. Because Julian day numbers run in a continuous sequence, taking the day number modulo seven gives the day of the week, with a fixed offset that puts Sunday at zero.

Adding days to a date is then trivial: convert the date to a day number, add the offset, and convert back. This handles month ends, year ends and leap days without any special-case logic.

Subtracting days works the same way with a negative offset. Going back from 1 March in a common year to 28 February is one day; going back from 1 March in a leap year is two, and the day-number method gets both right automatically.

The number of whole weeks between two dates is the day count divided by seven and rounded down. A span of ten days is one whole week plus three days.

The number of months between two dates is ambiguous, because months have different lengths. Dividing by the average month length gives a summary figure, but the exact answer needs the borrowing method used for ages.

Business-day counts are a separate problem. Weekends and public holidays have to be excluded, which the simple day difference does not do.

Interest and term calculations often use a day-count convention rather than the plain difference. The actual over three-sixty-five convention divides the actual day count by three hundred and sixty-five, while other conventions assume thirty-day months.

Because the calculation is exact, it is useful for contract terms, notice periods, warranty windows, project schedules and anything else that turns on a date.

The calculator takes both dates as day, month and year numbers, so enter each part in its own box. The offset is the number of days to add to the from date, and it can be negative.

Formula

JDN = d + floor((153m + 2) / 5) + 365y + floor(y/4) - floor(y/100) + floor(y/400) - 32045

Converts a calendar date into a continuous day count, where a equals floor((14 minus month) divided by 12), y equals year plus 4800 minus a, and m equals month plus 12a minus 3.

SymbolMeaning
dDay of the month
mShifted month
yShifted year

Days = JDN(to) - JDN(from)

The difference between two day numbers is the exact number of days between the dates.

SymbolMeaning
JDN fromFrom day number
JDN toTo day number

How To Calculate Days Between Dates

  1. 1

    Convert the from date

    Apply the Julian day formula to the day, month and year of the starting date to get its day number.

  2. 2

    Convert the to date

    Apply the same formula to the ending date. The two day numbers are now comparable.

  3. 3

    Subtract for the difference

    The to day number minus the from day number is the exact number of days between the dates.

  4. 4

    Add the offset

    Add the offset in days to the from day number, then convert the result back to a calendar date.

  5. 5

    Read the weekday

    Take the day number modulo seven and offset it so that zero is Sunday. That gives the day of the week for the new date.

Examples

Example 1: 1 January 2026 to 20 September 2026, plus 30 days

From day
1
From month
1
From year
2026
To day
20
To month
9
To year
2026
Days to add
30
StepCalculationResult
Day of the new date1 January 2026 plus 30 days31
Month of the new datestill January1
Year of the new dateunchanged2026
Weekday of the new date0 = Sunday, 6 = Saturday6
Whole weeks betweenfloor(262 / 7)37
Days between20 September 2026 - 1 January 2026262

Result: Adding 30 days to 1 January 2026 lands on 31 January 2026, a Saturday. The two reference dates are 262 days apart, which is 37 whole weeks.

Example 2: 25 December 2026 plus 10 days

From day
25
From month
12
From year
2026
To day
25
To month
12
To year
2026
Days to add
10
StepCalculationResult
Day of the new date25 December 2026 plus 10 days4
Month of the new daterolls into January1
Year of the new daterolls into the next year2027
Weekday of the new date0 = Sunday, 1 = Monday1
Days between the reference datesthe same date0

Result: Adding 10 days to 25 December 2026 rolls past the end of the year and lands on 4 January 2027, a Monday, with 0 days between the two reference dates.

Calculator

Days between

262

Whole weeks between
37
New date: day
31
New date: month
1
New date: year
2,026
New date: weekday (0 = Sunday)
6

Values update as you type. This calculator covers the single scenario its formula assumes — see Common Mistakes for what it leaves out.

Prefer a full-width tool? Open the Days Between Dates calculator page.

Common Mistakes

  • Assuming every month has thirty days

    Months run from twenty-eight to thirty-one days. A thirty-day approximation drifts by several days over a year and is wrong for anything contractual.

  • Forgetting leap years

    A leap day is added every four years, except in century years not divisible by four hundred. The day-number method handles this automatically; manual counting usually does not.

  • Counting the start date twice

    The number of days between 1 January and 2 January is one, not two. The difference of the day numbers is inclusive of one endpoint and exclusive of the other.

  • Mixing up the from and to dates

    Subtracting in the wrong order gives a negative day count. Swap the dates or take the absolute value when only the size of the gap matters.

  • Confusing days with business days

    A day difference counts weekends and holidays. If the answer needs working days, weekends and public holidays have to be removed separately.

  • Using a 365-day year for term interest

    Day-count conventions differ. Actual over three-sixty-five divides the real day count by three hundred and sixty-five, while thirty over three-sixty assumes thirty-day months.

  • Overflowing a year boundary by hand

    Adding days across a year end is where manual arithmetic fails most often. Convert to a day number, add, and convert back instead.

FAQ

How do I count the days between two dates?

Convert both dates to Julian day numbers and subtract the earlier from the later. The difference is the exact number of days, including the effect of leap years.

Does the count include the end date?

The difference gives the number of days from the start date to the end date, so the start is counted and the end is not. Add one if you need both endpoints included.

How do I add days to a date?

Convert the date to a day number, add the number of days, and convert the result back to a calendar date. Month ends, year ends and leap days all follow automatically.

How is the weekday determined?

Julian day numbers run continuously, so taking the day number modulo seven and applying a fixed offset gives the day of the week, with Sunday as zero.

Can the offset be negative?

Yes. A negative offset subtracts days from the from date, which is how you find a date that is a set number of days in the past.

How many weeks is 262 days?

Thirty-seven whole weeks, with three days left over, since 37 times 7 is 259 and 262 minus 259 is 3.

References

  1. [1]Wikipedia, Julian Day Number — https://en.wikipedia.org/wiki/Julian_day
  2. [2]Wikipedia, Day Count Convention — https://en.wikipedia.org/wiki/Day_count_convention
  3. [3]timeanddate.com, Date Duration Calculator — https://www.timeanddate.com/date/duration.html