How the calculation works
The calculator validates each value as a four-digit Gregorian calendar date from 0001-01-01 through 9999-12-31. It converts each date to an integer day position, then subtracts the start position from the end position. Positive results move forward in time; negative results indicate a reversed range.
No JavaScript Date parsing or midnight timestamp arithmetic is used. That keeps the result independent of your timezone and avoids daylight-saving shifts.
Conventions used
- Elapsed days: excludes the starting instant, so the same date is zero elapsed days.
- Inclusive count: counts both named dates and adds exactly one to the absolute counted span.
- Calendar duration: finds whole years first, then whole months, then remaining days.
- Month ends: anniversaries clamp to the final valid day. January 31 to February 28 is therefore one calendar month in a non-leap year.
Common questions
Does the calculator include the end date?
The standard elapsed result does not count both endpoint dates. Turn on “Count both endpoint dates” when you need an inclusive count.
Why can the signed result be negative?
A negative value means the end date comes before the start date. The absolute duration and calendar breakdown remain non-negative.
How are leap years handled?
Years divisible by four are leap years, except century years unless they are also divisible by 400. Thus 2000 was a leap year and 1900 was not.
Will daylight saving time change the answer?
No. The calculator operates on calendar fields and integer day positions, not local timestamps.