Why are "years" and "months" approximate?
Years vary between 365 and 366 days; months vary between 28 and 31 days. The "Total years" and "Total months" rows divide the millisecond gap by 365.25 and 30.4375 respectively, which is the average length over a 400-year Gregorian cycle. The "Calendar" breakdown ("1 year, 2 months, 14 days") is exact — it walks the calendar from start to end and counts whole years, then whole months, then leftover days.
How are leap years handled?
Leap years are handled implicitly because the calculator works with millisecond timestamps and JavaScript Date objects, both of which know the calendar. February 29 counts as one day; a span that crosses Feb 29 has one extra day compared to the same range in a non-leap year. The 365.25 divisor for "Total years" is an average, not an assumption that every year has the same length.
What is a business day?
In this calculator a business day is any day Monday-Friday that is not a public holiday (when the holiday filter is on). The count walks day by day from start to end, skipping Saturday (day 6) and Sunday (day 0). It does not skip the start date itself — only days strictly after start and up to and including end are counted.
Which holidays are excluded?
When the country is set to United States and Exclude holidays is on, seven federal holidays are skipped: New Year's Day, Martin Luther King Jr. Day, Memorial Day, Independence Day, Labor Day, Thanksgiving, and Christmas. The dates are pre-computed for 2024-2027 and use the observed date when the holiday falls on a weekend (e.g. July 4 2026 falls on a Saturday, observed July 3).
Can I use this to calculate age?
Yes — set start to the date of birth and end to today (click Now). The Calendar breakdown ("32 years, 4 months, 11 days") is the standard way to express age. The "Total years" decimal is useful for actuarial or scientific calculations where you need a continuous value.
How do I exclude weekends in different languages?
JavaScript: loop with date.getDay() and skip 0 (Sun) and 6 (Sat). Python: pandas.bdate_range(start, end) or numpy.busday_count(start, end). SQL (Postgres): generate_series(start, end, '1 day') filtered with EXTRACT(dow FROM d) NOT IN (0, 6). Excel: NETWORKDAYS(start, end, [holidays]). All of these treat the count as exclusive of the start, inclusive of the end — same convention as this tool.
Does this account for time zones?
The two datetime-local inputs are read in your browser's local time zone (no offset suffix). The millisecond difference is therefore zone-agnostic — a 24-hour gap is exactly 24 hours regardless of DST. If you need to compare across zones (e.g. 9 AM PST to 9 AM EST), convert both to UTC first using the Timezone Converter, then enter the UTC values here.
Why is end-before-start shown as negative?
A negative interval indicates the second date is earlier than the first — common when computing "time until deadline" for a deadline that has already passed. The Calendar field also shows a leading minus. If you would rather see absolute values, click Swap to flip the inputs in one click.