Day Calculator Between Dates in Months
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 number of whole months between two dates, and also gives the leftover days, so you get an answer like “3 months and 12 days” rather than just a vague “about 3 months.” You enter a start date and an end date, and it returns the month count, the remaining days, and the total days for reference. The calculation is based on calendar months, not on a fixed 30-day month, which is the most common way people think about “months between dates” in everyday planning.
Formula
The calculator uses the standard calendar-month method: count the number of complete months from the start date to the end date, then count any extra days beyond the last complete month. The formula in words is:
- Months = (year of end date − year of start date) × 12 + (month of end date − month of start date), then subtract 1 if the day of the end date is earlier than the day of the start date.
- Leftover days = (day of end date − day of start date), and if that is negative, add the number of days in the start date’s month.
In symbols, where Y, M, D are the year, month, and day of each date:
Months = (Yend − Ystart) × 12 + (Mend − Mstart) − (1 if Dend < Dstart, else 0)
Leftover days = Dend − Dstart + (days in month of start date if Dend < Dstart, else 0)
All values are integers. The “total days” output is simply the number of days between the two dates, which is useful for cross-checking.
Worked Example
Using the default values: start date = January 15, 2024, end date = May 27, 2024.
- Compute the month difference: (2024 − 2024) × 12 + (5 − 1) = 4 months.
- Compare days: 27 (end) is not less than 15 (start), so no adjustment. Whole months = 4.
- Leftover days: 27 − 15 = 12 days.
- Total days: from Jan 15 to May 27 is 133 days (Jan 16–31 = 16, Feb = 29, Mar = 31, Apr = 30, May 1–27 = 27; 16+29+31+30+27 = 133).
So the result is 4 months and 12 days, which matches the calculator’s output.
Why Calendar Months Matter
Many people assume a month is 30 days, but that leads to errors. For example, from February 1 to March 1 is exactly 1 month, but only 28 or 29 days. Conversely, from January 31 to February 28 is usually considered 1 month (or 28 days), not “0 months and 28 days.” The calendar-month method respects the actual lengths of months, which is what you need for things like lease terms, subscription renewals, or project milestones. If you instead used a fixed 30-day month, you would get a different answer for almost any date pair that spans months of different lengths.
How to Read the Result
The result “4 months and 12 days” means that if you add 4 months to the start date, you get a date that is 12 days before the end date. In the example, adding 4 months to Jan 15 gives May 15, and then 12 more days brings you to May 27. This is intuitive for planning: you can think of the interval as “4 full months plus a bit.” The leftover days will always be between 0 and 30, because if it were 31 or more, that would constitute another full month.
Common Mistakes and How to Avoid Them
- Ignoring the day comparison: The most common error is to simply subtract month numbers without checking the day. For example, from Jan 31 to Feb 28, the month difference is 1, but the day of the end (28) is less than the day of the start (31), so you must subtract 1, giving 0 months and 28 days. Many people would say “1 month,” but that is only true if you round up, which is not the standard for “whole months.”
- Using 30 days for a month: This gives wrong results for intervals that cross February or months with 31 days. For instance, from March 1 to April 1 is 1 month, but 31 days. A 30-day assumption would say 1 month and 1 day, which is incorrect.
- Forgetting leap years: February has 29 days in a leap year. The calculator handles this automatically, but if you do it by hand, remember to check if the start date’s year is a leap year when adding days.
- Confusing “months” with “days”: The total days output is not the same as “months × 30 + days.” It is the actual number of days, which you can use to verify the result.
When to Use This Calculator
This calculator is useful for any situation where you need to express a time span in months and days, rather than just days. Common examples include:
- Calculating the length of a lease or rental agreement.
- Determining how many months old a baby is (e.g., “7 months and 3 days”).
- Planning project timelines where milestones are set in months.
- Checking subscription or warranty periods that are defined in months.
For age in years and months, you would also use the same month-counting method, but then divide the months by 12 to get years. This calculator gives you the raw months, so you can easily convert.
Limitations and Edge Cases
The calculator assumes you are counting whole calendar months from the start date. It does not handle “end-of-month” conventions, such as treating Jan 31 to Feb 28 as “1 month” because both are the last day of their month. If you need that convention, you would add a rule: if the start day is the last day of the month, and the end day is the last day of the month, count it as a full month. This calculator does not do that; it strictly compares day numbers. Also, if the end date is before the start date, the result will be negative months and days, which may not be meaningful. For most practical uses, ensure the end date is after the start date.
Frequently Asked Questions
How do I calculate months between two dates in Excel?
Excel has a DATEDIF function that can do this: =DATEDIF(start_date, end_date, “m”) gives whole months, and =DATEDIF(start_date, end_date, “md”) gives leftover days. However, DATEDIF has quirks with end-of-month dates, so it may not match this calculator in all cases. For example, DATEDIF(“2024-01-31”, “2024-02-28”, “m”) returns 0, which matches this calculator, but DATEDIF(“2024-01-31”, “2024-03-31”, “m”) returns 2, which is also correct here.
What is the difference between calendar months and lunar months?
A calendar month is based on the Gregorian calendar, with lengths from 28 to 31 days. A lunar month is the time between successive new moons, about 29.53 days. This calculator uses calendar months, which is what most people mean in everyday contexts. Lunar months are used in some religious calendars and astronomy, but not in typical date arithmetic.
How many months is 90 days?
It depends on the start date. If you start on January 1, 90 days later is March 31, which is 2 months and 30 days (or 3 months if you round up). If you start on February 1, 90 days later is May 1, which is 3 months exactly (since Feb 1 to May 1 is 3 months). This is why you cannot simply divide days by 30 to get months.
Does the calculator account for leap years?
Yes, because it uses the actual calendar. The number of days in February is 29 in a leap year, and the total days calculation reflects that. For example, from February 1, 2024 to March 1, 2024 is 29 days, and the calculator will show 1 month and 0 days.
What if the end date is before the start date?
The calculator will return negative months and days. For example, from May 27, 2024 to January 15, 2024 gives “-4 months and -12 days.” That is not useful for most purposes, so you should swap the dates if you want a positive duration. The absolute value of the total days will be correct.
Is “1 month and 30 days” the same as “2 months”?
No, not in calendar terms. If you add 1 month and 30 days to a date, you may not land on the same date as adding 2 months. For example, from January 1, adding 1 month gives February 1, then 30 days gives March 2. Adding 2 months gives March 1. The difference arises because February has fewer than 30 days. The calculator gives you the exact whole months and leftover days, so you can see the distinction.
Related
Formula used
in start | Start date | - | 2024-01-15 | 0 in end | End date | - | 2024-05-27 | 0 out months | Whole months | months | floor((year(end)-year(start))*12 + (month(end)-month(start)) + (day(end) < day(start) ? -1 : 0)) | 0 out days | Leftover days | days | day(end) - day(start) + (day(end) < day(start) ? days_in_month(start) : 0) | 0 out total | Total days | days | end - start | 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.