How to Calculate the Time Between Two Dates

Working out how much time separates two dates sounds simple, but month lengths and leap years make it surprisingly easy to get wrong. Here's how it really works.

Count the days first

The most reliable way to measure the gap between two dates is to count the actual calendar days between them, then convert that count into weeks, months or years as needed. Counting days sidesteps the awkwardness of months having 28, 30 or 31 days.

A common shortcut — dividing the number of days by 365 to get years — drifts off over long spans because it ignores leap years. Every four years (with rare exceptions) February gains a day, and those extra days add up.

Turning days into years, months and days

To express a duration the way people speak — 'two years, three months and five days' — you count whole years from the start date, then whole months, then the leftover days, borrowing from the previous month when the day-of-month would go negative.

This calendar-aware method is what official forms and our Date Difference Calculator use, so the result matches what a human would count by hand.

Inclusive or exclusive?

Decide whether you want to count the nights between two dates or include both endpoints. A hotel stay from the 1st to the 5th is four nights but touches five calendar days. If you need both ends included, add one to the day count.