{
  "id": "weeks",
  "version": "ffe7c75c96e6",
  "status": "published",
  "name": "Weeks Calculator",
  "question": "Week calculator from date",
  "summary": "Counts the weeks from one date to another: whole weeks and days, the same span as a decimal number of weeks, and in months and days.",
  "category": "days",
  "subcategory": "dates",
  "url": "https://www.acalculator.org/days/weeks-calculator",
  "markdown": "https://www.acalculator.org/days/weeks-calculator.md",
  "kind": "function",
  "method": "days = to date − from date; weeks = days ÷ 7 rounded down, with days − 7 × weeks days left",
  "assumptions": [
    "Dates are whole calendar days in the Gregorian calendar, with no time of day.",
    "The from date is not counted and the to date is: from a Monday to the next Monday is 1 week.",
    "The from date is today unless you change it; the page reads today’s date from your device when it loads.",
    "A from date after the to date has no answer."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "start": {
        "title": "From date",
        "description": "The date to count from. Today, unless you change it.",
        "type": "string",
        "format": "date"
      },
      "end": {
        "title": "To date",
        "description": "The date to count to.",
        "type": "string",
        "format": "date"
      }
    }
  },
  "outputs": {
    "weeks": {
      "label": "Weeks",
      "description": "Whole weeks and the days left from the start date to the end date.",
      "format": "duration"
    },
    "decimal": {
      "label": "In weeks",
      "description": "The days ÷ 7, as a decimal number of weeks.",
      "format": "number"
    },
    "days": {
      "label": "Days",
      "description": "Calendar days from the start date to the end date.",
      "format": "integer"
    },
    "span": {
      "label": "In years, months, and days",
      "description": "The time from the start date to the end date as whole years, then whole months, then days.",
      "format": "duration"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "start": "2026-09-30",
      "end": "2026-12-23"
    },
    "outputs": {
      "weeks": {
        "weeks": 12,
        "days": 0
      },
      "decimal": 12,
      "days": 84,
      "span": {
        "years": 0,
        "months": 2,
        "days": 23
      }
    },
    "text": "From September 30, 2026 to December 23, 2026 is 12 weeks."
  },
  "examples": [
    {
      "given": {
        "start": "2026-09-30",
        "end": "2026-12-25"
      },
      "expect": {
        "weeks": {
          "weeks": 12,
          "days": 2
        },
        "decimal": 12.285714285714286,
        "days": 86,
        "span": {
          "years": 0,
          "months": 2,
          "days": 25
        }
      },
      "source": "Julian Day numbers (Meeus, Astronomical Algorithms, 1991, chapter 7): JD 2461399.5 − JD 2461313.5 = 86 days; hand calculation in content.mdx"
    },
    {
      "given": {
        "start": "2026-01-01",
        "end": "2026-12-31"
      },
      "expect": {
        "weeks": {
          "weeks": 52,
          "days": 0
        },
        "decimal": 52,
        "days": 364
      },
      "source": "Gregorian calendar (ISO 8601): a common year has 365 days, 52 weeks and 1 day; hand calculation in content.mdx"
    },
    {
      "given": {
        "start": "2024-02-01",
        "end": "2024-03-01"
      },
      "expect": {
        "weeks": {
          "weeks": 4,
          "days": 1
        },
        "decimal": 4.142857142857143,
        "days": 29
      },
      "source": "Gregorian leap-year rule (ISO 8601); hand calculation in content.mdx"
    }
  ],
  "sources": [
    "Jean Meeus, Astronomical Algorithms (1991), chapter 7: Julian Day numbers, so the days between two dates are the difference of their Julian Days.",
    "ISO 8601, Date and time format: the Gregorian calendar, its leap-year rule, and the 7-day week."
  ],
  "related": [
    "days-between-dates",
    "days-from-today",
    "date",
    "months-between-dates"
  ],
  "changelog": []
}
