help-calc

08 Numbers and Units

Days Apart Calculator: Find the Difference

Card 08-0081 · Updated · Standard formula, shown below

The calculator on this page is switched off while it is checked. The formula is below, and the worked example shows how to do the sum by hand.

A days apart calculator works out the exact number of days between two dates, telling you how much time has passed or will pass from one date to another. You enter a start date and an end date, and you get the total days, often broken down into weeks, months, and years for easier understanding. This simple tool is useful for planning events, tracking deadlines, calculating ages, or figuring out how long something has lasted.

Formula

The calculator uses the most straightforward method: it converts both dates to timestamps (the number of milliseconds since January 1, 1970), subtracts the start timestamp from the end timestamp, and then converts the difference into days by dividing by 86,400,000 (the number of milliseconds in one day).

In words: Days = (End Date – Start Date) / 86,400,000

Where:

  • End Date and Start Date are the dates you input, converted to milliseconds.
  • 86,400,000 is the number of milliseconds in one day (24 hours × 60 minutes × 60 seconds × 1000 milliseconds).

The result is a whole number of days. If you want weeks, divide the days by 7. For approximate months, divide by 30.44 (the average number of days in a month, accounting for leap years).

Worked Example

Using the default values from the calculator: start date = January 1, 2024, and end date = December 31, 2024.

  1. Convert both dates to milliseconds since the epoch (January 1, 1970). This is done internally by the calculator.
  2. Subtract the start timestamp from the end timestamp. The difference in milliseconds is 31,536,000,000 (since 2024 is a leap year, it has 366 days).
  3. Divide by 86,400,000 to get days: 31,536,000,000 ÷ 86,400,000 = 365 days (wait, 2024 is a leap year, so it should be 366 days—let’s check the arithmetic).

Actually, let’s recalculate carefully. The number of milliseconds in a day is 86,400,000. For 366 days, the total milliseconds would be 366 × 86,400,000 = 31,622,400,000. So the difference between Jan 1 and Dec 31, 2024 is 366 days, because the end date is inclusive? No, the calculator subtracts start from end, so if start is Jan 1 and end is Dec 31, the difference is 365 days (since Dec 31 is the 365th day after Jan 1). But 2024 has 366 days, so the difference between Jan 1 and Dec 31 is 365 days. The calculator gives 365 days. That matches the default output? The default output shows 365 days? Let’s see: the block shows out days with expression (end – start)/86400000, and the default values are 2024-01-01 and 2024-12-31. The difference is 365 days. So the output is 365. Good.

So the worked example: Start = Jan 1, 2024, End = Dec 31, 2024. Difference = 365 days. Weeks = 52 (since 365/7 = 52.14, floor gives 52). Approximate months = 12.0 (365/30.44 ≈ 11.99, rounded to 12.0). The calculator’s default shows these values.

How to Use a Days Apart Calculator

Using a days apart calculator is straightforward, but there are a few things to keep in mind:

  • Date format: Most calculators expect dates in a specific format (e.g., YYYY-MM-DD or MM/DD/YYYY). Enter the dates exactly as requested.
  • Start and end dates: The start date is the earlier date, and the end date is the later date. If you swap them, you’ll get a negative number (or an error).
  • Inclusive vs. exclusive: Some calculators count the start date as day 1, others don’t. This calculator subtracts start from end, so the start date is not counted. For example, from Jan 1 to Jan 2 is 1 day, not 2.
  • Time of day: If you enter times, the result may include fractional days. This calculator ignores time and uses midnight as the default time for each date.

Why You Might Need It

There are many practical reasons to calculate the number of days between two dates:

  • Project planning: How many days until a deadline or event?
  • Age calculation: How many days old is a person or an animal?
  • Billing and contracts: How many days between service start and end dates?
  • Historical research: How many days between two historical events?
  • Fitness and habits: How many days have you been following a routine?

Knowing the exact number of days can help with scheduling, budgeting, and tracking progress.

Common Mistakes and Misconceptions

One common mistake is assuming that a month always has 30 days. In reality, months vary from 28 to 31 days, so if you need an exact count, always use days, not months. Another mistake is confusing “days apart” with “days including the start date.” For example, if an event starts on March 1 and ends on March 3, the days apart are 2 (March 1 to March 3), but the duration including both start and end is 3 days.

Another misconception is that a leap year always has 366 days, which is true, but the day count between two dates in a leap year still depends on the specific dates. For instance, from Feb 28 to Mar 1 in a leap year is 2 days, not 1, because Feb 29 exists.

Limitations of the Formula

The simple subtraction method works perfectly for dates after 1970 (the Unix epoch) and up to the year 9999 (the upper limit for most date systems). However, if you need to calculate days between dates before 1900 or after 9999, you may need a more advanced method that accounts for calendar changes (like the Gregorian calendar adoption) and time zones. Also, daylight saving time shifts can affect the exact number of hours, but since we’re counting whole days, this is usually not an issue.

For most practical purposes, the formula is accurate and sufficient. If you need to include time zones or specific times of day, you’ll need a more complex calculator that handles those variables.

Frequently Asked Questions

How do I count days between two dates manually?

You can count by hand using a calendar: mark the start date, then count each day until the end date, but don’t count the start date itself. For longer periods, you can use the formula: convert both dates to Julian day numbers (a continuous count of days since a fixed date) and subtract. Many online calculators do this automatically.

Does the calculator include the start date?

No, this calculator subtracts the start date from the end date, so the start date is not counted. For example, from June 1 to June 2 is 1 day. If you want to include both dates, add 1 to the result.

What if I enter the dates in the wrong order?

If you swap the start and end dates, the result will be negative. The calculator may show a negative number or an error. Always enter the earlier date as the start date and the later date as the end date.

Can I calculate days between dates in different years?

Yes, the calculator works for any dates within the supported range (1900 to 9999). It correctly handles leap years and varying month lengths.

Why is the result sometimes 365 or 366 days for a year?

A common year has 365 days, and a leap year has 366. The difference between Jan 1 and Dec 31 of the same year is 364 days (since Dec 31 is the 364th day after Jan 1), but the total number of days in the year is 365 or 366. The calculator gives the difference, not the total days in the year.

How do I convert days to weeks and months?

Divide the number of days by 7 to get weeks (with a remainder for extra days). For months, divide by 30.44 (the average month length) to get an approximate number of months. This is useful for rough planning, but remember that actual month lengths vary.

Alternatives and Related Calculations

If you need more than just the number of days, there are related calculators:

  • Business days calculator: Counts only weekdays (Monday to Friday), excluding weekends and optionally holidays.
  • Age calculator: Computes a person’s exact age in years, months, and days.
  • Date addition/subtraction: Adds or subtracts a number of days, weeks, or months from a given date.
  • Time duration calculator: Measures hours, minutes, and seconds between two times on the same day or across days.

These tools are often available on the same websites as the days apart calculator, so you can switch between them as needed.

Related

Formula used
in start | Start date | - | 2024-01-01 | 1900-01-01
in end | End date | - | 2024-12-31 | 1900-01-01
out days | Total days | days | (end - start) / 86400000 | 0
out weeks | Weeks | weeks | floor((end - start) / 604800000) | 0
out months | Approx. months | months | round((end - start) / 2629800000, 1) | 1

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.

More on this shelf

The whole Numbers and Units shelf →