The number of days between two dates is the later date minus the earlier one. That count is exclusive: it counts the steps from one date to the next, so 1 March to 31 March is 30 days. When both the first and the last day should count, as in "the course runs 1–31 March", add 1 and you get 31. Days have one right answer. Months do not: 31 January to 1 March can honestly be "29 days" or "1 month 1 day", depending on what the tool thinks one month after 31 January is.

You can check any of the examples below in the FindUtils Date Difference Calculator, which shows the day count, the weeks and a years-months-days line for two dates.

Days Are Fence Gaps, Not Fence Posts

Picture each date as a fence post. Subtraction counts the gaps between posts, not the posts. Five posts in a row have four gaps; Monday to Friday is 4 days apart, but it is 5 days if you are counting the days you worked.

QuestionCountExample: 10 May to 14 May
Nights in a hotelExclusive (subtract)4 nights
Days until an eventExclusive (subtract)4 days to go
Days a conference runsInclusive (subtract, then +1)5 days
Days charged at a daily rate, first and last day billedInclusive (+1)5 days

The mistake happens when one person thinks in posts and the other in gaps. Before you count, decide whether the start date is a day you spend or a point you leave from.

How Deadlines Are Counted

Contracts, courts and agencies settle the question in writing. A well-known example is Rule 6(a)(1) of the US Federal Rules of Civil Procedure. For a period stated in days or longer, it says to:

  • "exclude the day of the event that triggers the period",
  • "count every day, including intermediate Saturdays, Sundays, and legal holidays", and
  • "include the last day of the period", unless it is a Saturday, Sunday or legal holiday, in which case the period runs until the next day that is not.

That is exclusive counting with a weekend rollover. Take an event on Thursday 29 October 2026 and a 30-day period:

  1. Day 1 is Friday 30 October, the day after the event.
  2. Day 30 is Saturday 28 November 2026, which is also what 29 October + 30 days gives.
  3. Saturday and Sunday do not end a period, so the deadline moves to Monday 30 November.

The committee notes explain why many court periods are now 7, 14, 21 or 28 days: "the 14th day after a Monday, for example, is a Monday." A multiple of 7 always ends on the same weekday as the start.

Rules differ between countries and contracts, so read the clause that applies to you. The arithmetic part, though, is always "subtract, then decide about the first day, then check the weekday".

Business Days Are a Second Count

A calendar day count includes weekends. For working days, start from the calendar count:

  1. Each full week has 5 weekdays.
  2. Count the weekdays in the leftover days by hand.
  3. Remove public holidays that fall on weekdays.

Monday 2 November 2026 to Monday 30 November 2026 is 28 days, exactly 4 weeks, so 20 weekdays. Thanksgiving in the United States falls on Thursday 26 November 2026, which leaves 19 business days there and 20 in most other countries.

Months: Where Calculators Disagree

A month is not a fixed number of days, so a tool that reports "X months and Y days" has to decide what adding one month means when the day does not exist in the next month.

Python's dateutil documents its rule plainly: "If the result falls on a day after the last one of the month, the last day of the month is used instead." Its own examples show date(2003,1,31) + relativedelta(months=+1) giving 28 February 2003. JavaScript's Temporal API makes the same choice by default: its overflow option defaults to 'constrain', and its docs show 31 March 2019 minus one month as 28 February 2019.

Once "one month after 31 January" is 28 February, the differences follow. We ran the same date pairs through Temporal's until() with years as the largest unit, and through dateutil:

FromToDaysTemporal and dateutilDay-of-month method
31 Jan 202628 Feb 2026281 month28 days
31 Jan 20261 Mar 2026291 month 1 day29 days or 1 month 1 day, depending on the tool
1 Mar 202631 Mar 20263030 days30 days
29 Feb 202428 Feb 20253651 year11 months 30 days

The "day-of-month method" is the one people use by hand: compare the day numbers and borrow a month when the end day is smaller. It never calls 31 January to 28 February a month, because 28 is less than 31. Neither answer is wrong. They answer slightly different questions.

Spreadsheets add a third behaviour. Microsoft's own page for Excel's DATEDIF warns that the "MD" unit, which returns the days left after whole months, "may result in a negative number, a zero, or an inaccurate result", and suggests that for a plain day count you simply subtract one date from the other.

Three practical rules come out of this:

  • When money or a deadline depends on it, state the period in days. "30 days" is the same in every system. "1 month" is not.
  • When you need months, say which rule you use, for example "same day number next month, or the last day of the month if that day does not exist".
  • Check birthdays on 29 February. Libraries that clamp to the month end say someone born on 29 February 2024 turns 1 on 28 February 2025; other rules say 1 March. The Age Calculator is the place to check an age.

Days Are Not Always 24 Hours

In places with daylight saving time, one day each spring has 23 hours and one day each autumn has 25. A date difference in days is right, but days × 24 is not the clock time across those changes. The same Rule 6 committee notes give an example: a 72-hour period that starts at 10:23 a.m. on Friday 2 November 2007 "will run until 9:23 a.m. on Monday, November 5", because the clocks went back during the weekend.

If hours matter, measure between two date-times in the same time zone, or use the Time Difference Calculator for two clock readings. For meetings across regions, convert first with the Timezone Converter.

The Time Zone Off-by-One

The most common date bug in web forms is a day that moves backwards. In JavaScript, a date-only string such as "2026-03-01" is read as midnight UTC. MDN's page on Date.parse() says it plainly: a date-only value "will imply UTC time". Show that moment in local time in New York and it is still the evening before:

JS
1
2
3
4
// Device time zone: America/New_York
const d = new Date("2026-03-01");
d.getDate();     // 28  (local: Sat 28 Feb 2026, 19:00)
d.getUTCDate();  // 1

Any code that reads a date-only value as UTC and then asks for the local day, month or year will be one day off for everyone west of UTC, and for some dates the shift crosses into the previous month. The day difference between two such values is still right, because both move by the same amount, but a "months and days" breakdown built from the local parts can change with the user's time zone.

Two ways to avoid it:

  • Keep plain dates as plain dates: Temporal's PlainDate has no time zone at all.
  • If you must use Date, read and write the parts with the UTC methods (getUTCDate() and so on), or parse with an explicit local time such as "2026-03-01T00:00".

If your dates come from logs or APIs as numbers, convert them with the Unix Timestamp Converter first, and check whether they are seconds or milliseconds; this post explains the difference.

A Checklist for Counting Days

  1. Subtract the dates to get the exclusive day count.
  2. Add 1 if both the first and the last day are days you count.
  3. Check the weekday of the last day if a deadline cannot end on a weekend or holiday.
  4. Use days, not months, for anything paid or legally binding, or write down your month rule.
  5. Do not multiply by 24 across a daylight saving change; measure the clock time instead.
  6. Watch the time zone when software turns a date into a date-time.

Need help with a project? The team behind FindUtils takes on freelance work through Upwork, including a Laravel Livewire app or admin panel with dynamic pages and forms.

FAQ

How do I count the days between two dates including both dates?

Subtract the earlier date from the later one and add 1. 1 March to 31 March 2026 is 30 days apart and 31 days counted inclusively.

Why do two calculators give different months for the same dates?

They use different rules for adding a month to a date near the end of the month. Libraries such as dateutil and Temporal treat 31 January plus one month as 28 February; a day-number comparison does not. The day count is the same in both.

What is one month after 31 January?

In dateutil and Temporal's default mode it is 28 February, or 29 February in a leap year. Some systems roll over to 2 or 3 March instead, so write the rule into contracts and specs.

Does "within 30 days" include the first day?

Under US Federal Rule of Civil Procedure 6(a), no: the day of the triggering event is excluded and the last day is included, with a rollover past weekends and legal holidays. Other rules can differ, so read the one that applies.

Why is my date one day earlier in the browser?

A date-only string like "2026-03-01" is parsed as midnight UTC. West of UTC that moment is still the previous evening locally, so local getters return the day before. Use UTC getters or a time-zone-free date type.

Sources