Difference
Years
Months
Days
Total Weeks
Total Days

About the Date Difference Calculator

Calculating the exact number of days, months, or years between two dates requires accounting for leap years (divisible by 4, except century years not divisible by 400), varying month lengths (28-31 days), and for precise calculations, timezone and daylight saving transitions. This calculator handles all Gregorian calendar rules correctly using the browser's built-in date arithmetic.

Common uses for date difference calculations

Calendar days vs working days

Calendar days is the simple count of all days between two dates. Working days excludes weekends (and optionally public holidays). Working day calculations matter for contracts with notice periods, delivery timescales, legal deadlines, and financial settlement dates where weekends are non-business days.

Date arithmetic in programming

Every major programming language provides date arithmetic utilities. JavaScript's Date object, Python's datetime module, and SQL date functions all support adding days, months, and calculating differences. The key rule: always store dates and times in UTC, convert to local time only for display, and use the IANA timezone database for timezone-aware operations.

Frequently Asked Questions

How do I calculate the number of days between two dates?
This calculator shows the difference instantly. Manually: convert both dates to a day count (days since a fixed reference point), then subtract. Programming languages do this natively: in JavaScript Math.round((d2-d1)/(1000*60*60*24)); in Python (d2-d1).days.
How do I calculate the number of months between two dates?
Count complete months: (end year - start year) x 12 + (end month - start month). Adjust if the end day is before the start day (one less complete month). Example: 15 March to 10 August = (0 x 12) + (8-3) = 5 months, minus 1 because 10th is before 15th = 4 complete months.
Does this calculator handle leap years?
Yes. The calculator uses JavaScript's Date object which correctly handles all Gregorian calendar rules including leap years (divisible by 4, except century years not divisible by 400). 29 February 2000 is valid; 29 February 1900 is not.
Why might my date calculation be off by one day?
This often results from timezone offset. If both dates are at midnight local time, crossing a daylight saving transition can result in 23 or 25 hours in the boundary day, appearing to lose or gain a day. Using UTC-normalised dates avoids this.
How do I add a specific number of days to a date?
In JavaScript: new Date(date.getTime() + days * 86400000). In Python: date + timedelta(days=n). In Excel or Google Sheets: =A1+90 adds 90 days. Use the Days Until tool to find what date falls N days from today.
Related tools
Ad