{
  "category": "Date and time functions",
  "display_name": "DAYS",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.DAYS",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20430"
      ],
      "larger_numeric": 0,
      "last_bit": 0,
      "matched": 9565,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 9565,
      "unread": 0,
      "worst_ulp": 0
    },
    "detail": "Recorded: 9,565 in the answer bank and 7 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 9,572 recorded answers",
    "workbook_corpus": {
      "cells": 7,
      "matched": 7
    }
  },
  "implementations": [
    {
      "commit": "9e1884369a678158dd82d3d74188daf986995e87",
      "flavour": "excel-compatibility-candidate",
      "language": "Rust",
      "name": "CalcFunc",
      "own_code": [
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/dates.rs#L254-L261"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/dates::environment",
        "catalogue/dates::system",
        "catalogue/dates::to_1900",
        "catalogue/dates::date_arg",
        "ported/date_kernels::days"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/dates.rs#L254-L261",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 9,572 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.DAYS.json",
  "name": "DAYS",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n### Relationships\n\n\n- **The `−` operator.** `end − start` on two date serials gives the same number for numeric\n  arguments and is not equivalent for text arguments, because `−` uses the engine's ordinary\n  text-to-number coercion while `DAYS` is documented to use `DATEVALUE`. This is the sharpest\n  reason to prefer `DAYS` when inputs may be text — and to prefer `−` when they may not, since\n  `DAYS` then buys nothing but a locale dependency.\n- **[DATEDIF](FUNC.DATEDIF.md) with unit `\"D\"`** — the same count, but with start-first argument\n  order and with a documented `#NUM!` when start is after end, where `DAYS` simply goes negative.\n- **[DAYS360](FUNC.DAYS360.md)** — an interval in *accounting* days, not calendar days; the two\n  functions answer different questions and are routinely confused.\n- **[NETWORKDAYS](FUNC.NETWORKDAYS.md)** — calendar days minus weekends and holidays.\n- **[DAY](FUNC.DAY.md)** — the near-homonym, and unrelated: day-of-month of a single date.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n1. **Implement the two coercion paths separately and visibly.** A single \"coerce to number\"\n   front-end will silently give `DAYS` the wrong behaviour for text, because ordinary numeric\n   coercion does not parse \"1-Jan-2024\" and `DATEVALUE` does.\n3. **Pin the truncation order** before writing tests, and state it in the implementation, since the\n   documentation does not.\n4. **Do not \"fix\" the leap-year artefact here.** The count is defined on serials; correcting for\n   the phantom day would make `DAYS` disagree with subtraction, which is the one thing the\n   documentation guarantees it does not do.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns a `Number`: an integer count of days, negative when `start_date` is later than `end_date`.\n\n- **Equal dates** give 0.\n- **Fractional serials** do not produce a fractional answer; Microsoft's remark that the result\n  carries no time component says the truncation happens, but the page does not say whether each\n  argument is truncated before subtracting or the difference is truncated afterwards. Those two\n  rules disagree — `DAYS(2.4, 1.6)` is 1 under the first and 0 under the second. **This is not\n  settled here.**\n- **Straddling the 1900 leap-year artefact.** An interval whose endpoints lie on opposite sides of\n  serial 60 counts the phantom 29 February 1900 as a real day. `DAYS(61, 59)` is 2 as arithmetic\n  and one day too many as a calendar fact. See [FUNC.DATE](FUNC.DATE.md).\n- **Mixed numeric/text arguments** take one path each, per the documented rule.\n\n\n\n### Errors\n\n\nAs documented on the Microsoft page:\n\n- `#NUM!` when numeric date arguments fall outside the range of valid dates.\n- `#VALUE!` when a text argument cannot be parsed as a valid date.\n\nAn error value passed as either argument propagates in the ordinary way.\n\n\n",
    "sources": "\n- Microsoft 365 support, **DAYS function** —\n  <https://support.microsoft.com/en-us/office/days-function-57740535-d549-4395-8728-0f07bff0b9df>.\n  Source of the argument order, the `EndDate–StartDate` rule, the `DATEVALUE` treatment of text\n  arguments, and both error conditions.\n- [FUNC.DATE](FUNC.DATE.md) — serial-number model and the 1900 leap-year artefact.\n- [FUNC.DATEVALUE](FUNC.DATEVALUE.md) — the parser this function delegates to for text.\n- Handbook call-model chapter [02 coercion and lifting](../model/02-coercion-and-lifting.md), whose\n  per-family policy framing this function is a clean instance of.\n- `data/functions/FUNC.DAYS.json`, `data/presence/FUNC.DAYS.json`, `data/battery/FUNC.DAYS.json`.\n\n",
    "version-differences": "The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.\n\n| Excel 16.0 build | Platform and CPU | Captured inputs |\n|---|---|---:|\n| 20430 | Windows, 64-bit, CPU not recorded | 9,565 |\n\nThe record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.\n\n[Recorded environments and comparison details](https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.DAYS.json).",
    "what-it-does": "\n`DAYS` returns the signed number of days from `start_date` to `end_date`. Microsoft's page states\nthe rule directly: when both arguments are numbers, `DAYS` computes **end − start**. So it is\nsubtraction with a name — and with a documented coercion policy that plain subtraction does not\nhave.\n\nTwo things make it worth a page of its own rather than a footnote to the `−` operator:\n\n1. **The argument order is end-first.** `DAYS(end_date, start_date)`. Every other two-date\n   function in the category — [DATEDIF](FUNC.DATEDIF.md), [DAYS360](FUNC.DAYS360.md),\n   [NETWORKDAYS](FUNC.NETWORKDAYS.md), [YEARFRAC](FUNC.YEARFRAC.md) — takes start first. `DAYS` is\n   the exception, and getting it wrong silently returns the negation rather than an error.\n2. **Text arguments are routed through `DATEVALUE`, not through ordinary numeric coercion.**\n   Microsoft documents that \"if either one of the date arguments is text, that argument is treated\n   as `DATEVALUE(date_text)`\". This is a per-function coercion policy, not the engine-wide\n   text-to-number rule described in\n   [coercion and lifting](../model/02-coercion-and-lifting.md) — and it drags `DAYS` into locale\n   dependence that the numeric path does not have. `DAYS(\"3/1/2024\", \"1/1/2024\")` is a\n   locale-sensitive expression; `DAYS(45352, 45292)` is not.\n\n\n\n### Arguments\n\n\n`DAYS(end_date, start_date)` — both required.\n\n**end_date** — the later endpoint by convention, though nothing requires it to be later; a\nstart after the end simply gives a negative result.\n\n**start_date** — the earlier endpoint by convention.\n\nBoth arguments accept either a numeric serial or text. The documentation's own wording keeps the\ntwo paths separate: numbers are subtracted, text is parsed by `DATEVALUE` first. Microsoft also\nnotes that the result is an integer without time components, so fractional serials contribute no\nfractional days.\n\nThe argument position most often misused is the first one. Because the function is named for a\nquantity rather than a direction, readers frequently write `DAYS(start, end)` and get a negative\nnumber that then flows quietly into a downstream calculation.\n\n\n"
  },
  "signature": {
    "display": "DAYS(end_date, start_date)",
    "parameters": [
      {
        "description": null,
        "name": "end_date",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "start_date",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 2,
        "min": 2
      },
      "category": "Date and time functions",
      "classification": {
        "arg_preparation_profile": "ValuesOnlyPreAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "None",
        "host_interaction_class": "None",
        "kernel_signature_class": "Custom",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "Number of days from one date to another",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the number of days between two dates",
        "microsoft_url": "https://support.microsoft.com/en-us/office/days-function-57740535-d549-4395-8728-0f07bff0b9df"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "أيام"
        },
        {
          "locale": "bg-BG",
          "name": "DAYS"
        },
        {
          "locale": "cs-CZ",
          "name": "DAYS"
        },
        {
          "locale": "da-DK",
          "name": "DAGE"
        },
        {
          "locale": "de-DE",
          "name": "TAGE"
        },
        {
          "locale": "el-GR",
          "name": "DAYS"
        },
        {
          "locale": "en-AU",
          "name": "DAYS"
        },
        {
          "locale": "en-GB",
          "name": "DAYS"
        },
        {
          "locale": "en-US",
          "name": "DAYS"
        },
        {
          "locale": "es-ES",
          "name": "DIAS"
        },
        {
          "locale": "et-EE",
          "name": "DAYS"
        },
        {
          "locale": "fi-FI",
          "name": "PÄIVÄT"
        },
        {
          "locale": "fr-FR",
          "name": "JOURS*"
        },
        {
          "locale": "he-IL",
          "name": "DAYS"
        },
        {
          "locale": "hr-HR",
          "name": "DAYS"
        },
        {
          "locale": "hu-HU",
          "name": "NAPOK"
        },
        {
          "locale": "id-ID",
          "name": "HARI"
        },
        {
          "locale": "it-IT",
          "name": "DAYS"
        },
        {
          "locale": "ja-JP",
          "name": "DAYS"
        },
        {
          "locale": "ko-KR",
          "name": "DAYS"
        },
        {
          "locale": "lt-LT",
          "name": "DAYS"
        },
        {
          "locale": "lv-LV",
          "name": "DAYS"
        },
        {
          "locale": "nb-NO",
          "name": "DAYS"
        },
        {
          "locale": "nl-NL",
          "name": "DAGEN"
        },
        {
          "locale": "pl-PL",
          "name": "DNI"
        },
        {
          "locale": "pt-BR",
          "name": "DIAS"
        },
        {
          "locale": "pt-PT",
          "name": "DIAS"
        },
        {
          "locale": "ro-RO",
          "name": "DAYS"
        },
        {
          "locale": "ru-RU",
          "name": "ДНИ"
        },
        {
          "locale": "sk-SK",
          "name": "DAYS"
        },
        {
          "locale": "sl-SI",
          "name": "DAYS"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "DANI"
        },
        {
          "locale": "sv-SE",
          "name": "DAGAR"
        },
        {
          "locale": "th-TH",
          "name": "DAYS"
        },
        {
          "locale": "tr-TR",
          "name": "GÜNSAY"
        },
        {
          "locale": "uk-UA",
          "name": "DAYS"
        },
        {
          "locale": "vi-VN",
          "name": "DAYS"
        },
        {
          "locale": "zh-CN",
          "name": "DAYS"
        },
        {
          "locale": "zh-HK",
          "name": "DAYS"
        },
        {
          "locale": "zh-TW",
          "name": "DAYS"
        }
      ],
      "signature": {
        "display": "DAYS(end_date, start_date)",
        "parameters": [
          {
            "description": null,
            "name": "end_date",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "start_date",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "DAYS",
      "version_marker": null,
      "xlcall": {
        "code": "573",
        "symbol": "xlfDays"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/days-function-57740535-d549-4395-8728-0f07bff0b9df"
  },
  "try_it": {
    "formula": "=DAYS(DATE(2026,3,1),DATE(2026,1,1))"
  },
  "url": "https://handbook.dnacalc.com/functions/DAYS.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "9,565 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 20430",
      "platform": "Windows, 64-bit, CPU not recorded",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.DAYS.json"
      ]
    }
  ]
}