ThisCalculator

Date and time

Date Calculator Tool: How to Count Days

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.

Date Calculator Tool: How to Count Days

A date calculator tool works out the number of days, weeks, or months between two dates, or finds a new date by adding or subtracting a set amount of time from a starting date. You enter a start date, an end date (or a duration), and the tool returns the exact span in days, along with options for weeks and months. This page explains the math behind those calculations, how to use the tool correctly, and the common pitfalls that lead to wrong answers.

Formula

The core formula is simple: Days = End Date − Start Date. Each date is internally converted to a serial number (the number of days since a fixed reference point, such as 1900-01-01). The difference between the two serial numbers is the number of days between them. For weeks, divide the day count by 7. For workdays, the formula counts full weeks (each contributing 5 weekdays) and then handles the remaining partial week by subtracting the start day offset and clamping to 0–5.

Variables:

  • Start Date – the earlier date, in YYYY-MM-DD format.
  • End Date – the later date, in YYYY-MM-DD format.
  • Days – the absolute difference in days (always a whole number).
  • Weeks – days divided by 7, displayed with two decimals.
  • Workdays – the count of Monday through Friday days in the interval.

Worked Example

Using the default values: start = 2024-01-01, end = 2024-12-31.

  1. Convert both dates to serial numbers. 2024 is a leap year, so January 1 is day 1, and December 31 is day 366 (since February has 29 days).
  2. Days = 366 − 1 = 365 days.
  3. Weeks = 365 / 7 = 52.14 weeks.
  4. Workdays: 365 days contain 52 full weeks (260 weekdays) plus 1 extra day (a Monday in 2024, since Jan 1 is a Monday). The extra day is a weekday, so workdays = 260 + 1 = 261.

The calculator shows: Days = 365, Weeks = 52.14, Workdays = 261. This matches the formula output exactly.

How a Date Calculator Works

Behind the scenes, date calculators use a system of serial numbers. Every date is assigned a unique integer representing the number of days elapsed since a fixed epoch. For example, the Unix epoch is January 1, 1970, and the Excel epoch is January 1, 1900. The calculator converts your input dates to these serial numbers, performs the subtraction, and then converts the result back to a human-readable format.

Key operations include:

  • Date difference – subtract two serial numbers to get days.
  • Date addition – add a number of days to a serial number and convert back to a date.
  • Weekday calculation – uses the day-of-week of the start date to adjust the count.
  • Leap year handling – the serial system automatically accounts for February 29.

Most online tools also handle time-of-day if you enter times, but the pure date calculator ignores hours and minutes, treating each date as a whole day.

When to Use a Date Calculator

Date calculators are useful in many everyday situations:

  • Project planning – determining deadlines and milestones.
  • Billing and invoicing – calculating days between service dates.
  • Travel booking – counting nights or days of a trip.
  • Legal and contractual – computing notice periods or interest accrual days.
  • Personal tracking – days since a birthday, anniversary, or habit streak.

For example, if you start a 30-day free trial on March 15, the end date is April 14 (not April 15, because the start day counts as day 1). A date calculator makes this clear instantly.

Common Mistakes and Misconceptions

One frequent error is off-by-one confusion. If an event starts on Monday and ends on Friday, many people count 5 days, but the difference is actually 4 days (Tue, Wed, Thu, Fri). The calculator returns the raw difference, not the number of days “inclusive.�

Another issue is time of day. If you enter “2024-01-01� and “2024-01-02� without times, some tools treat the first as midnight and the second as midnight, giving 1 day. But if you enter a time on the end date, the result might be less than 1 day. Always check whether the tool expects dates only or dates with times.

Leap years are another trap. February 29 exists only every four years, and a date calculator’s serial system handles it, but if you manually count days, you might forget the extra day. For example, from 2024-02-28 to 2025-02-28 is 366 days, not 365.

How to Choose a Date Calculator Tool

Not all date calculators are equal. Consider these factors:

  • Input format – does it accept YYYY-MM-DD, MM/DD/YYYY, or both?
  • Output options – can it show weeks, workdays, or business days?
  • Time handling – does it ignore time or account for it?
  • Inclusive/exclusive – does it add 1 to the day count to include the start day?
  • Leap year accuracy – does it correctly handle February 29?

For most purposes, a simple tool that uses the standard serial-number method is accurate. Avoid tools that claim to “count business days� unless they let you specify holidays, because business days vary by region and year.

Limitations of Date Calculators

Date calculators assume the Gregorian calendar, which is the standard in most of the world. They do not account for historical calendar changes (like the Julian-to-Gregorian switch) unless specifically designed for that. They also ignore time zones, which can affect day boundaries if you are crossing them.

For business days, the calculator above counts Monday–Friday only. It does not exclude public holidays, because those vary by country and year. If you need to exclude holidays, you must manually adjust the result or use a specialized business-day calculator that lets you input a holiday list.

Finally, the calculator returns the raw difference. It does not tell you the date that is “30 days from now� unless you use the addition mode. Always check whether the tool you are using has both difference and addition functions.

Frequently Asked Questions

How do I count days between two dates manually?

First, convert both dates to day-of-year numbers. For example, March 1 is day 60 in a non-leap year (31+28+1). Subtract the earlier day-of-year from the later one. If the dates span a year boundary, add 365 (or 366 if a leap year falls in between). This manual method works, but it is error-prone for long spans.

Does the date calculator include the end date?

No, the standard difference does not include the end date. If you want to count the end date as well, add 1 to the result. For instance, from Jan 1 to Jan 3, the difference is 2 days, but the inclusive count is 3 days (Jan 1, 2, 3).

What is the difference between calendar days and business days?

Calendar days include every day of the week. Business days exclude weekends (Saturday and Sunday) and often public holidays. The calculator above counts Monday–Friday as business days, but does not subtract holidays. For a precise business-day count, you need a tool that lets you enter holidays.

How do I add 90 days to a date?

Use the addition mode of a date calculator. Enter the start date and the number of days (90). The tool will output the resulting date. For example, adding 90 days to 2024-01-01 gives 2024-03-31 (because 2024 is a leap year, so January has 31, February has 29, and March has 31, totaling 91 days by March 31).

Why does my date calculator give a different result than Excel?

Excel uses the 1900 date system, which has a known bug: it treats 1900 as a leap year. For dates after 1900, this does not affect results. However, Excel’s DAYS function returns the difference as a number, and it may handle time-of-day differently. Always compare the exact dates and times you entered.

Can I calculate age with a date calculator?

Yes, if you enter a birth date and the current date, the difference gives the number of days. To get years, divide by 365.25, but that yields a decimal. For a precise age in years, months, and days, you need a dedicated age calculator that accounts for month lengths.

Related

Formula used
in start | Start date | - | 2024-01-01 | 0
in end | End date | - | 2024-12-31 | 0
out days | Days between | days | end - start | 0
out weeks | Weeks (incl. partial) | weeks | (end - start) / 7 | 2
out workdays | Weekdays (Mon-Fri) | days | floor((end - start) / 7) * 5 + min(max((end - start) % 7 - 1, 0), 5) | 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.