On this page (9)
How to use this calculator#
- Put the earlier date firstThe tool handles a reversed range, but reading the result is easier when the sign is positive. For a duration that spans a leap day, check that 29 February is inside your range — it changes the total by one.
- Decide inclusive or exclusive before you quote the numberThe result is the number of full days between the two dates. Add one if both bookends count, which is how notice periods, hotel stays counted in nights versus days, and ‘within 30 days including today’ clauses usually work.
- Use the years-months-days breakdown for long spans‘4 months 18 days’ communicates better than 138 days. The breakdown counts whole calendar months, so it never assumes a month is 30 days.
- Use total days for anything you need to divideSplitting work across a period, calculating a daily rate or pro-rating a charge all need the raw day count. Months of unequal length make the calendar breakdown useless for arithmetic.
The formula#
Elapsed and inclusive day counts
Elapsed days = ordinal(End) − ordinal(Start) • Inclusive days = Elapsed days + 1 • Weeks = ⌊Elapsed ÷ 7⌋ with the remainder as loose days
- Start
- The earlier calendar date
- End
- The later calendar date
- ordinal(d)
- A serial day number for date d — day-of-year within one year, or a Julian day number across years. The difference is what matters, not the origin
- Elapsed days
- The exclusive count: midnights crossed between Start and End. Start-to-Start is 0
- Inclusive days
- The count with both bookends included, one greater than elapsed
Elapsed counting is the default here and in almost every spreadsheet: subtracting one date from another in Excel or Google Sheets returns the exclusive figure. Legal and commercial texts vary — ‘within 30 days’ usually excludes the trigger day and includes the deadline day, while ‘30 clear days’ excludes both. Leap years need no adjustment because the count runs over real calendar dates, so a range containing 29 February is automatically one day longer.
Counting time between dates#
The difference between two dates can be expressed several ways at once: total days is the simplest, while a years-months-days breakdown is more human-friendly for long spans.
Worked examples#
A project window measured three ways
12 February 2026 to 30 June 2026.
- Day-of-year for 12 February = 31 + 12 = 43
- Day-of-year for 30 June = 151 + 30 = 181
- 181 − 43 = 138 elapsed days; 139 if both dates count
- 138 ÷ 7 = 19 weeks with 5 days left over
- Calendar breakdown: 12 Feb → 12 Jun is 4 whole months, then 12 Jun → 30 Jun is 18 days
138 days (139 inclusive) — 19 weeks 5 days, or 4 months 18 days.
The same two months, one day apart
1 January to 1 March, in 2027 and again in 2028.
- 2027: January contributes 31 days and February 28 → 31 + 28 = 59 days
- 2028: January contributes 31 and February 29 → 31 + 29 = 60 days
- 2028 is divisible by 4 and is not a century year, so it is a leap year
- 2100 is divisible by 100 but not by 400, so it will be a common year
59 days in 2027 and 60 in 2028. Any calculation that hard-codes 365 days a year drifts by one day for every leap year it crosses.
Reference tables#
| Month | Days | Days before it (common year) | Days before it (leap year) |
|---|---|---|---|
| January | 31 | 0 | 0 |
| February | 28 (29 in a leap year) | 31 | 31 |
| March | 31 | 59 | 60 |
| April | 30 | 90 | 91 |
| May | 31 | 120 | 121 |
| June | 30 | 151 | 152 |
| July | 31 | 181 | 182 |
| August | 31 | 212 | 213 |
| September | 30 | 243 | 244 |
| October | 31 | 273 | 274 |
| November | 30 | 304 | 305 |
| December | 31 | 334 | 335 |
Example: 4 August is 212 + 4 = day 216 of a common year, and 25 December is 334 + 25 = day 359. Subtracting gives 143 days between them without touching a calendar.
| Duration | Days | Notes |
|---|---|---|
| 1 week | 7 | Always exactly 7 |
| 2 weeks (a fortnight) | 14 | Always exactly 14 |
| 1 month | 28 to 31 | Never a fixed number — use calendar months, not 30-day blocks |
| 30 days | 30 | Roughly a month, and the basis of Net 30 payment terms |
| 1 quarter | 90 to 92 | Q1 is 90 days in a common year, 91 in a leap year |
| 90 days | 90 | Between 2 months 28 days and 3 months 1 day, depending on the start date |
| 6 months | 181 to 184 | The exact figure depends on which half of the year |
| 1 year | 365 or 366 | 366 whenever the span contains a 29 February |
| 18 months | 546 to 550 | — |
| 2 years | 730 or 731 | — |
| 5 years | 1,826 or 1,827 | 1 Jan 2026 to 1 Jan 2031 is 1,826 days, containing one leap day |
| 10 years | 3,652 or 3,653 | — |
Anything above a month is a range, not a constant. Quote the exact dates alongside the day count whenever the difference could matter.
Common mistakes#
- The off-by-one on inclusive counting‘Five working days from Monday to Friday’ is five days inclusive but four elapsed. Spreadsheets return the elapsed figure, most contracts mean the inclusive one, and the gap of a single day is enough to miss a filing deadline or over-bill a hotel stay by a night.
- Dividing days by 30 to get months138 ÷ 30 = 4.6 months, but the real answer is 4 months 18 days — and 18 days is more than half of some months and less than half of others. Only whole calendar months make sense as a unit, and they have to be counted, not derived.
- Assuming every day has 24 hoursIn regions that observe daylight saving, one day each spring has 23 hours and one each autumn has 25. Computing a date difference in milliseconds and dividing by 86,400,000 can therefore return 29.96 or 30.04 days instead of 30, which truncates to the wrong integer.
- Letting a time zone shift the endpointsParsing ‘2026-03-14’ as a UTC instant and rendering it in a US time zone shows 13 March. Do that at both ends and the difference can come out a day short. Treat date-only values as calendar dates with no time component.
Frequently asked questions#
Is the end date included?
The result is the number of full days between the two dates. Add one if you need to count both the start and end day inclusively.
Can I use it for future dates?
Yes — put any future date as the end date to count down to it.
Key terms#
- Elapsed (exclusive) days
- The number of midnights crossed between two dates. What subtracting dates in a spreadsheet returns.
- Inclusive days
- Elapsed days plus one, counting both the first and last day. The convention behind most contractual day counts.
- Clear days
- A legal term excluding both the first and the last day, so ‘seven clear days’ notice means nine calendar days from notice to event.
- Day-of-year (ordinal date)
- The position of a date within its year, 1 to 365 or 366. 1 March is day 60 in a common year and day 61 in a leap year.
- Julian day number
- A continuous count of days used in astronomy and by date libraries, which makes differences across years a simple subtraction.
- ISO 8601
- The international date standard, YYYY-MM-DD, plus a duration syntax such as P4M18D for four months and eighteen days.
Sources#
- ISO 8601 date and time format — International Organization for Standardization
- RFC 3339 — Date and Time on the Internet: Timestamps — IETF
- Daylight saving time and civil timekeeping — NIST Time and Frequency Division
Figures last checked .
Put this calculator on your site
Free, no sign-up, and no attribution fee — just keep the credit line that comes with the code. The calculator stays up to date automatically.
