{
  "id": "days-between-dates",
  "version": "6570c46f9e88",
  "status": "published",
  "name": "Days Between Dates Calculator",
  "question": "How many days between dates?",
  "summary": "Counts the calendar days between two dates, or the working days without weekends and public holidays, with an option to count the end date.",
  "category": "days",
  "subcategory": "dates",
  "url": "https://www.acalculator.org/days/betweendates-calculator",
  "markdown": "https://www.acalculator.org/days/betweendates-calculator.md",
  "kind": "function",
  "method": "Count the days from the start date up to the end date (the end date too when asked); for working days, leave out the chosen weekend days and the country’s observed public holidays.",
  "assumptions": [
    "The start date is counted; the end date is counted only when “Count the end date” is on. So January 1 to January 3 is 2 days, or 3 with the end date.",
    "When the end date is before the start date, the two dates swap and the count is negative.",
    "Dates are calendar days with no time of day, so daylight-saving changes cannot add or lose a day.",
    "Public holidays are the days off as observed (a holiday on a weekend moves to a weekday where the country’s rule says so). Holiday data covers the US from 1986, the UK (England and Wales) from 2019 to 2028, Canada (federal) from 2021, India (central government) from 2023 to 2027, and China from 2015 to 2035."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "start": {
        "title": "Start date",
        "description": "The first date. It is counted.",
        "type": "string",
        "format": "date"
      },
      "end": {
        "title": "End date",
        "description": "The last date. It is counted only when “Count the end date” is on.",
        "type": "string",
        "format": "date"
      },
      "includeEnd": {
        "title": "Count the end date",
        "description": "Count the end date as one more day.",
        "type": "boolean"
      },
      "useWorkingDays": {
        "title": "Count working days only",
        "description": "Count only working days instead of every calendar day.",
        "type": "boolean"
      },
      "excludeSaturday": {
        "title": "Skip Saturdays",
        "description": "Leave Saturdays out of the count.",
        "type": "boolean"
      },
      "excludeSunday": {
        "title": "Skip Sundays",
        "description": "Leave Sundays out of the count.",
        "type": "boolean"
      },
      "excludeHolidays": {
        "title": "Skip public holidays",
        "description": "Leave the chosen country's public holidays out of the count.",
        "type": "boolean"
      },
      "country": {
        "title": "Country",
        "description": "The country whose public holidays are skipped.",
        "type": "string",
        "enum": [
          "us",
          "uk",
          "ca",
          "in",
          "cn"
        ]
      }
    }
  },
  "outputs": {
    "count": {
      "label": "Days",
      "description": "Calendar days, or working days when “Count working days only” is on. Negative when the end date is first.",
      "format": "integer"
    },
    "what": {
      "label": "Counted",
      "description": "Whether the count is of calendar days or working days.",
      "format": "text"
    },
    "calendarDays": {
      "label": "Calendar days",
      "description": "Every day in the count, weekends and holidays included.",
      "format": "integer"
    },
    "skipped": {
      "label": "Days skipped",
      "description": "Weekend days and public holidays left out of the working-day count.",
      "format": "integer"
    },
    "weeks": {
      "label": "In weeks",
      "description": "The number of calendar days (without the minus sign) as whole weeks and days.",
      "format": "duration"
    },
    "span": {
      "label": "In years, months, and days",
      "description": "The number of calendar days (without the minus sign) as whole years, months, and days, counted from the earlier date.",
      "format": "duration"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "start": "2026-10-06",
      "end": "2026-11-05",
      "includeEnd": false,
      "useWorkingDays": false,
      "excludeSaturday": true,
      "excludeSunday": true,
      "excludeHolidays": true,
      "country": "us"
    },
    "outputs": {
      "count": 30,
      "what": "calendar days",
      "calendarDays": 30,
      "weeks": {
        "weeks": 4,
        "days": 2
      },
      "span": {
        "years": 0,
        "months": 0,
        "days": 30
      }
    },
    "text": "From October 6, 2026 to November 5, 2026: 30 calendar days."
  },
  "examples": [
    {
      "given": {
        "start": "2026-01-01",
        "end": "2026-12-31",
        "includeEnd": false,
        "useWorkingDays": false
      },
      "expect": {
        "count": 364,
        "calendarDays": 364,
        "weeks": {
          "weeks": 52,
          "days": 0
        },
        "span": {
          "years": 0,
          "months": 11,
          "days": 30
        }
      },
      "source": "hand calculation in content.mdx; Python: (date(2026,12,31) - date(2026,1,1)).days = 364"
    },
    {
      "given": {
        "start": "2026-01-01",
        "end": "2026-12-31",
        "includeEnd": true,
        "useWorkingDays": false
      },
      "expect": {
        "count": 365,
        "span": {
          "years": 1,
          "months": 0,
          "days": 0
        }
      },
      "source": "hand calculation in content.mdx: 364 days plus the end date"
    },
    {
      "given": {
        "start": "2026-12-31",
        "end": "2026-01-01",
        "includeEnd": false,
        "useWorkingDays": false
      },
      "expect": {
        "count": -364,
        "calendarDays": -364
      },
      "source": "hand calculation in content.mdx: the dates swap and the count is negative"
    },
    {
      "given": {
        "start": "2024-02-01",
        "end": "2024-03-01",
        "includeEnd": false,
        "useWorkingDays": false
      },
      "expect": {
        "count": 29,
        "span": {
          "years": 0,
          "months": 1,
          "days": 0
        }
      },
      "source": "hand calculation in content.mdx; Python: (date(2024,3,1) - date(2024,2,1)).days = 29"
    },
    {
      "given": {
        "start": "2026-01-01",
        "end": "2026-01-31",
        "includeEnd": false,
        "useWorkingDays": true,
        "excludeSaturday": true,
        "excludeSunday": true,
        "excludeHolidays": true,
        "country": "us"
      },
      "expect": {
        "count": 20,
        "what": "working days",
        "calendarDays": 30,
        "skipped": 10
      },
      "source": "OPM federal holidays 2026 (https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/); hand calculation in content.mdx; Python cross-check in docs/progress/WP-27.md"
    },
    {
      "given": {
        "start": "2025-12-20",
        "end": "2026-01-05",
        "includeEnd": false,
        "useWorkingDays": true,
        "excludeSaturday": true,
        "excludeSunday": false,
        "excludeHolidays": false
      },
      "expect": {
        "count": 13,
        "calendarDays": 16,
        "skipped": 3
      },
      "source": "hand calculation in content.mdx: Saturdays December 20 and 27, 2025 and January 3, 2026"
    }
  ],
  "sources": [
    "U.S. Office of Personnel Management, Federal Holidays (5 U.S.C. 6103 and the weekend rule). https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/",
    "GOV.UK, UK bank holidays (England and Wales). https://www.gov.uk/bank-holidays",
    "Canada Labour Code, section 166, general holidays. https://laws-lois.justice.gc.ca/eng/acts/L-2/"
  ],
  "related": [
    "days-from-today",
    "dob",
    "age-difference"
  ],
  "changelog": [
    {
      "date": "2026-09-28",
      "note": "The answer reads “From … to …: N calendar days”, so a negative count reads as a signed number."
    }
  ]
}
