Date Duration Calculator
Date arithmetic is one of those tasks that looks simple but is full of edge cases. How many days until a deadline 3 months and 15 days away? When does a 2-year subscription that started today expire? What date was 90 days ago? These questions require adding or subtracting years, months, and days from a known date, accounting for the varying lengths of calendar months and leap years. This calculator handles that arithmetic correctly using the JavaScript Date object, which follows the Gregorian calendar and handles month-overflow situations automatically. You select a start date, choose whether to add or subtract, then enter the number of years, months, and days in the duration. The calculator returns the resulting date formatted in full (for example, Monday, 14 December 2026) and the total number of days in the duration so you can cross-reference with other tools. Common uses include finding a contract expiry date, a subscription renewal date, a notice period end date, a probationary period end, a warranty expiry date, or simply answering "what is 100 days from today?" All fields update live as you change any input.
How date duration is calculated
The calculator takes the start date and applies the years, months, and days in sequence using JavaScript's Date methods. Years and months are applied first (using setFullYear and setMonth), which correctly handles month overflow. Days are applied last with setDate.
newDate = new Date(startDate)
if add:
newDate.setFullYear(newDate.getFullYear() + years)
newDate.setMonth(newDate.getMonth() + months)
newDate.setDate(newDate.getDate() + days)
if subtract:
newDate.setFullYear(newDate.getFullYear() - years)
newDate.setMonth(newDate.getMonth() - months)
newDate.setDate(newDate.getDate() - days)
totalDays = Math.round(Math.abs(newDate - startDate) / 86400000)
Worked example
Start: 14 June 2026. Operation: Add. Years: 0, Months: 6, Days: 0.
Apply 0 years: still 14 June 2026. Apply 6 months: June + 6 = December. Result: Sunday, 14 December 2026 (183 days).
Date arithmetic in contracts and subscriptions
Most contracts, leases, and subscription agreements define duration in calendar months or years rather than days. A 12-month lease starting 1 July 2026 ends 30 June 2027 (not 365 days later). A 2-year warranty starting 14 June 2026 expires 14 June 2028. This calculator applies calendar month and year arithmetic correctly, so the results align with how most legal and financial documents define date periods.
When adding days only, the result is straightforward: one day is added per unit. When adding months, the day-of-month is preserved where possible. Month-end overflow (such as adding 1 month to 31 January) follows JavaScript's standard behavior.
Date duration calculator: frequently asked questions
How do I add months to a date?
Enter the start date, select Add from the operation dropdown, leave years and days at 0, and enter the number of months you want to add. The calculator returns the resulting date instantly. For example, adding 6 months to 14 June 2026 gives 14 December 2026.
What happens when adding months crosses a month end?
JavaScript's Date object handles month overflow automatically. If the resulting month does not have enough days for the original day-of-month, the date rolls over into the next month. For example, adding 1 month to 31 January 2026 would attempt to create 31 February 2026, which does not exist, so JavaScript returns 3 March 2026 (since February 2026 has 28 days). This is standard JavaScript date behavior and matches how most programming languages handle month arithmetic.
How do I find a date 90 days from now?
Set the start date to today, select Add from the operation dropdown, leave years and months at 0, and enter 90 in the days field. The calculator shows the resulting date and confirms the total day count is 90.
How do I calculate a contract expiry date?
Enter the contract start date as the start date, select Add, and enter the contract duration in years, months, or days (or a combination of all three). The resulting date shown is the expiry date. For example, a 2-year contract starting 14 June 2026 expires on 14 June 2028.
How do I find a date 6 months ago?
Set the start date to today, select Subtract from the operation dropdown, and enter 6 in the months field. The calculator returns the date 6 calendar months before today. This is useful for finding the start of a trailing 6-month period for financial or business reporting purposes.
Official sources
- MDN Web Docs, JavaScript Date object: developer.mozilla.org.
Reviewed by the CalculatorHub team, edited by James Graham, 14 June 2026. See our methodology.