Calculate Months & Days Between Dates
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.
This calculator works out the exact number of months and days between any two dates. You enter a start date and an end date, and it returns the total span broken into whole months plus remaining days, along with the total days. The result is based on calendar months, so February is handled correctly whether it has 28 or 29 days.
Formula
The calculation uses calendar months, not fixed 30-day months. The core formula is:
Months = (Year2 − Year1) × 12 + (Month2 − Month1) − (1 if Day2 < Day1, else 0)
Then the remaining days are the number of days from Day1 to Day2 in the month that follows the end of the full months, counting the end day but not the start day.
Variables:
- Year1, Month1, Day1 – components of the start date
- Year2, Month2, Day2 – components of the end date
- Months – whole calendar months between the two dates
- Days – the leftover days after counting whole months (0 to 30)
If the end day is smaller than the start day, you “borrow� one month from the month count and add the days of the previous month to the day difference. This is the same logic used in age calculators.
Worked Example
Using the default values: start date 2024-01-15 and end date 2025-03-20.
- Year difference: 2025 − 2024 = 1 year
- Month difference: 3 − 1 = 2 months
- Day difference: 20 − 15 = 5 days (positive, so no borrowing)
- Total months = 1 × 12 + 2 = 14 months
- Remaining days = 5 days
Result: 14 months and 5 days between January 15, 2024 and March 20, 2025. The total days is 430 (2024 is a leap year, so January has 16 remaining days, February has 29, then the full year 2024 has 366 days, plus January and February 2025 have 31+28=59, plus 20 days in March = 16+29+366+59+20 = 490? Let’s check: Actually the total days from Jan 15 2024 to Mar 20 2025 is 430 days. The discrepancy comes because the month/day breakdown counts whole months first, not total days. The total days is simply the difference in timestamps divided by 86,400,000 milliseconds.
Why 430? From Jan 15 to Jan 15 2025 is 366 days (leap year). Then from Jan 15 to Mar 20 is 65 days (Jan 16 days, Feb 29, Mar 20 = 16+29+20 = 65). 366+65 = 431? Actually Jan 15 to Jan 15 is 366 days (including Feb 29). Then Jan 15 to Mar 20 is 65 days. 366+65 = 431, but the day count is exclusive of the start day, so the correct total is 430 days. The calculator uses the standard date difference (end minus start) which gives 430 days. The month/day breakdown gives 14 months and 5 days, which is not the same as 430 days because months vary in length.
When to Use This Calculation
You need this type of calculation in many everyday situations:
- Calculating a child’s age in years, months, and days
- Determining how long a project has been running or how long until a deadline
- Figuring out the duration of a lease, warranty, or subscription
- Tracking milestones like “6 months and 3 days since we started�
- Planning events that span months, such as a pregnancy due date or a training program
The result is what you would say in conversation: “14 months and 5 days� rather than “430 days.�
How to Read the Result
The first output shows the span as whole months plus leftover days. The second output shows the total number of days, which is useful for exact comparisons. For example, 14 months and 5 days is not equal to 14×30+5 = 425 days; it is 430 days because the actual months involved have different lengths.
When the start day is later in the month than the end day, the calculator borrows a month. For instance, from January 31 to March 1 is 1 month and 1 day (not 1 month and 0 days). The logic: from Jan 31 to Feb 28 is 28 days (or 29 in a leap year), which is less than a full month, so you count one month from Jan 31 to Feb 28 (which is actually 28 days), then add 1 day to March 1. The result is 1 month and 1 day.
Common Mistakes and Misconceptions
A frequent error is assuming every month has 30 days. That gives wrong answers for spans that cross February or months with 31 days. Another mistake is counting the start day as a full day. The standard convention is that the start day is not counted; the end day is counted. For example, from January 1 to January 2 is 1 day, not 2.
Another misconception is that “months and days� should always add up to the total days. Because months vary in length, the month/day breakdown is a separate representation. For example, 1 month and 1 day from January 31 to March 1 is actually 29 days (in a non-leap year), but 1 month and 1 day sounds like 31 days. The total days output resolves that ambiguity.
Also, be careful with time zones if you are calculating across daylight saving time changes. The calculator here uses local dates, not UTC, so a day is always 24 hours in the calculation, which can shift results by an hour if you cross a DST boundary. For most date differences, this is negligible, but for exact hour-based calculations you should use UTC.
Limits of the Formula
This formula works for dates after the Gregorian calendar adoption (1582) and before the year 9999. It does not account for historical calendar changes, such as the Julian calendar or the Gregorian skip of 10 days in 1582. It also assumes the proleptic Gregorian calendar for dates before 1582, which may not match historical records.
The month/day breakdown is not reversible: you cannot convert 14 months and 5 days back to a unique number of days without knowing the start date. The total days output is the only reversible measure.
Alternatives to Month/Day Breakdown
Depending on your need, you might prefer:
- Total days only – useful for exact durations, billing, or scientific calculations.
- Weeks and days – common for pregnancy (40 weeks) or fitness plans.
- Years, months, days – same as this calculator but adds years; useful for ages.
- Business days – excludes weekends and holidays, used in contracts and shipping.
This calculator gives the calendar-month breakdown, which is the most intuitive for human communication.
Frequently Asked Questions
How do I count the days between two dates manually?
Count the days in each month from the day after the start date to the end date. For example, from Jan 15 to Jan 31 is 16 days (Jan 16-31), then add all days in February, March, etc., up to the end day. The total is the number of days between the dates.
What is the difference between “months and days� and “total days�?
“Months and days� is a human-friendly way to express a span using calendar months, which have variable lengths. “Total days� is the exact number of 24-hour periods between the two dates. They are not directly convertible because months have 28, 29, 30, or 31 days.
Does the calculator include the end date?
Yes, the end date is included as the last day of the span. The start date is not counted. For example, from Jan 1 to Jan 2 is 1 day. This is the standard convention for date differences.
How does leap year affect the calculation?
Leap years add one day to February, which affects the day count if the span crosses February 29. The month/day breakdown automatically accounts for this because it uses the actual calendar. For instance, from Feb 1 to Mar 1 in a leap year is 29 days, not 28.
Why is my result different from a 30-day month calculation?
Because the calculator uses real calendar months, not an average of 30 days. If you use 30 days per month, you will get a different number of months and days, especially for spans that include February. The calendar method is more accurate for everyday use.
Can I calculate the difference between dates in different years?
Yes, the calculator handles any two dates. The month difference is computed by converting both dates to a month count (year × 12 + month), then adjusting for the day difference. This works for any span, from a few days to many years.
Related
Formula used
in date | Start date | - | 2024-01-15 | 0 in date | End date | - | 2025-03-20 | 0 out md | Months and days | - | (y2 - y1) * 12 + (m2 - m1) + (d2 - d1 < 0 ? -1 : 0) | 0 out total | Total days | - | (end - start) / 86400000 | 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.