Skip to main content
📅 Calendar · Working days · Hours

Date Difference Calculator

Calculate the exact number of days, working days, weeks, and hours between any two dates — using Gregorian-aware arithmetic with optional Bangladesh public holiday exclusion.

Step By Step

How to Use This Calculator

  1. Enter a Start Date and an End Date using the date pickers — the order doesn't matter, the calculator always returns a positive result.
  2. Read the primary result: total calendar days, expressed as years · months · days and weeks · remaining days.
  3. Check 'Exclude Bangladesh public holidays' to subtract fixed national holidays from the working-day count (useful for payroll and leave calculations).
  4. Use the detail tiles for total weeks, total hours, working days (Mon–Fri), and weekend/holiday days.
  5. If the start date is in the future, a note below the result shows how many days from today it falls.

Worked Example

Example: Q1 project deadline

Use this sample to sanity-check your inputs and understand what the final result represents.

  • 1Start Date: 1 January 2026
  • 2End Date: 31 March 2026
  • 3Exclude holidays: No

Final Result

89 calendar days · 12 weeks 5 days · 2 months 30 days · 64 working days · 25 weekend days

Methodology

Calculation formulas & references

This section explains the calculation logic, assumptions, and source material used to make the result more trustworthy and easier to verify.

Total days = ⌊ (End − Start) ÷ 86,400,000 ms ⌋ — standard Julian Day difference (ISO 8601 / RFC 5545). Years–months–days breakdown uses Gregorian-aware arithmetic: whole calendar years, then whole calendar months, then remaining days — the same method used by most HR and legal systems. Working days = Σ weekdays (Mon–Fri) in the range, optionally minus fixed public holidays. Hours = Total days × 24. References: ISO 8601:2019 (date and time formats); Gregorian calendar reform (1582, Pope Gregory XIII); ECMA-262 §21.4 (JavaScript Date object).

Helpful tips

  • 1For payroll and leave requests, enable 'Exclude holidays' to get the net working-day count that BD employment law recognises.
  • 2Contract periods are often counted inclusively — add 1 to the result if your clause says 'from Day 1 to Day N inclusive'.
  • 3Leap years (e.g. 2024, 2028) are handled automatically; February 29 is a valid date in those years.
  • 4Working-day mode covers ranges up to 10 years. For longer ranges, the calendar-day figure is always available.

Frequently Asked Questions

How is the number of days between two dates calculated?+

The calculator subtracts the earlier date from the later date in milliseconds, then divides by 86,400,000 (the number of milliseconds in one day) and rounds to the nearest whole number. This is the standard Julian Day Number difference used in most calendar software and follows the proleptic Gregorian calendar (ISO 8601).

Why do the years/months/days breakdown not always add up to the total days?+

Because calendar months have different lengths (28–31 days). The years–months–days breakdown uses Gregorian-aware arithmetic: it counts exact calendar years, then exact calendar months, then remaining days. This matches how HR departments and courts count contract periods. The 'total days' figure is always the precise day count.

What counts as a working day?+

Working days are Monday through Friday, excluding Saturday and Sunday. When the 'Exclude Bangladesh public holidays' option is checked, fixed national holidays (21 Feb, 26 Mar, 14 Apr, 1 May, 16 Dec, 25 Dec) are also skipped. Note that moveable Islamic holidays such as Eid-ul-Fitr and Eid-ul-Adha are not included because their dates shift each year by the lunar calendar.

Is this calculator accurate for leap years?+

Yes. JavaScript's Date object follows the proleptic Gregorian calendar and handles leap years automatically. February 29 is treated as a valid date in any leap year (years divisible by 4, except centuries unless divisible by 400). The day count between, for example, 28 Feb 2024 and 1 Mar 2024 correctly returns 2 days because 2024 is a leap year.

What is the maximum date range this tool supports?+

The calendar-day count has no practical limit within JavaScript's date range (roughly ±270,000 years from 1970). The working-day counter is restricted to ranges of 10 years or fewer because iterating day-by-day over very long spans is computationally heavy in the browser. The hours figure is displayed for ranges up to approximately 136 years.

Can I use this for contract or legal date counting?+

This tool gives a reliable starting point but should not replace professional legal advice. Contract law in Bangladesh (and most jurisdictions) may define 'day' differently — for instance, some clauses count calendar days inclusively (i.e., both the start and end day). Always confirm the counting method specified in your agreement or consult a qualified lawyer.

Related Calculators

View all →