ThisCalculator

Everyday

Check If a Date Is Between Two Dates

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Check If a Date Is Between Two Dates

To check whether a date falls between two other dates, compare it with the earlier and later boundary: it is within the range if it is after the start and before the end. This calculator takes a date and two boundary dates, then reports whether the date is inside the range, including both endpoints.

Formula

For dates in chronological order, the inclusive test is start ≤ date ≤ end. In this calculator, the dates are entered as numeric year values, so the expression is (date − start) × (end − date). The result is zero when the checked date equals a boundary, positive when it lies strictly between the boundaries, and negative when it lies outside. The output is 1 for an inclusive match and 0 otherwise.

  • date (d): the value being checked, entered as a year.
  • start (s): the lower boundary, entered as a year.
  • end (e): the upper boundary, entered as a year.
  • inside: 1 means the value is between the boundaries, including either endpoint; 0 means it is not.

This simple numeric form demonstrates the comparison, but a year alone does not identify a particular calendar date. For real date checks, compare complete dates in a consistent format or use a date-aware spreadsheet or programming language. The worked example uses the calculator’s default year values exactly.

Worked Example

Defaults: date = 2026, start = 2026, and end = 2026.

  1. Subtract the start from the date: 2026 − 2026 = 0.
  2. Subtract the date from the end: 2026 − 2026 = 0.
  3. Multiply: 0 × 0 = 0.
  4. The date equals both boundaries, so the inclusive range test returns 1 (yes).

The expression’s raw numeric result is 0 at an endpoint; the displayed yes/no interpretation follows the inclusive rule, which includes endpoints. This illustrates why a date calculator should state its boundary convention rather than leave it implicit.

How to Check a Real Calendar Date

For actual dates, put the three values in chronological order and compare complete year-month-day values. The most direct test is: the checked date is on or after the start, and on or before the end. Both conditions must be true for an inclusive range.

  • Confirm that the start is earlier than or equal to the end.
  • Check that the candidate date is not earlier than the start.
  • Check that it is not later than the end.
  • Decide whether a date exactly on either boundary counts.

For example, if a range runs from March 1 through March 31, a check for March 15 is inside. March 1 and March 31 are also inside under the inclusive convention. February 28 and April 1 are outside. If the rule instead defines a half-open interval, such as “from March 1 up to but not including March 31,” then March 31 must be excluded.

Inclusive and Exclusive Boundaries

“Between” can mean different things in ordinary language and in technical rules. An inclusive range uses start ≤ date ≤ end; an exclusive range uses start < date < end. Mixed conventions are also common: one endpoint may count while the other does not. Always follow the definition used by the calendar, form, contract, software, or dataset you are working with.

A useful way to avoid ambiguity is to spell out the boundary rule: “including both dates,” “excluding the end date,” or “after the start and before the end.” This matters for events that begin or finish exactly at midnight, deadlines, booking periods, and date filters. Do not assume that the word “through” or “until” has the same interpretation in every system.

Dates, Time Zones, and Date Formats

A calendar date is not always the same thing as a precise moment. A date such as 2026-06-12 represents a day; a timestamp also includes a time and often a time zone. If a period is defined by timestamps, compare full timestamps after putting them in a consistent time zone. If it is defined as whole calendar days, compare calendar dates instead.

Use an unambiguous format such as YYYY-MM-DD when writing dates for data or technical instructions. Formats such as 04/05/2026 can mean April 5 or May 4, depending on regional convention. In a spreadsheet, enter genuine date values rather than text that merely looks like a date; text may sort alphabetically instead of chronologically.

Calendar arithmetic also requires care. Months have different lengths, and leap years add February 29. A check that only compares month and day while ignoring the year can give incorrect results across year boundaries. For instance, a period from December 20 to January 10 crosses into the next year; the endpoints need years to establish their order.

Common Mistakes and Limits

  • Reversing the boundaries: if the start is later than the end, a basic comparison may reject every date. Validate the order or deliberately normalize the boundaries.
  • Ignoring the year: month and day alone are insufficient for ranges spanning years or dates in different years.
  • Mixing formats: ambiguous numeric dates can be interpreted differently across regions. Use named months or year-first notation.
  • Confusing a date with a time: for a timestamp range, a date-only comparison may include or exclude part of a boundary day unexpectedly.
  • Assuming endpoints count: specify inclusive or exclusive behavior, especially when matching software filters or written rules.

The calculator block above is intentionally a year-value illustration, not a full calendar-date parser: its numeric inputs cannot represent month and day, validate impossible dates, or account for time zones. For an actual date, use a tool that accepts complete dates or perform the two date comparisons directly. The underlying logic is reliable when the inputs are valid, consistently represented, and ordered according to the rule you need.

Frequently Asked Questions

Does “between two dates” include the start and end dates?
It depends on the rule. An inclusive range includes both endpoints; an exclusive range excludes them. State the convention explicitly when it matters.

How do I check whether a date is between two dates in Excel?
For date values in cells, test that the candidate is greater than or equal to the start and less than or equal to the end. For example, with the candidate in A2, start in B2, and end in C2, use =AND(A2>=B2,A2<=C2). Ensure the cells contain real dates, not date-like text.

What if the start date is after the end date?
First decide whether that indicates invalid input or a range that wraps across a calendar boundary. For an ordinary chronological interval, correct the order. A cross-year seasonal range needs an explicit rule rather than a simple start-to-end comparison.

Can I compare dates written in different formats?
Only after interpreting them unambiguously and converting them to comparable date values. A string such as 03/04/2026 is ambiguous in some regions; use a clear format such as 2026-04-03 or write the month name.

Should I include the time when checking a date?
Include it when the rule concerns an exact moment or a timestamp interval. If the rule covers whole calendar days, compare dates in the relevant time zone and define whether the final day is included.

Related

Formula used
in d | Date to check | year | 2026 | 0
in s | Start date | year | 2026 | 0
in e | End date | year | 2026 | 0
out inside | Is date between dates (1=yes, 0=no) | - | (d-s)*(e-d) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.