{
  "category": "Date and time functions",
  "display_name": "DAY",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.DAY",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20430"
      ],
      "larger_numeric": 0,
      "last_bit": 0,
      "matched": 10153,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 10153,
      "unread": 0,
      "worst_ulp": 0
    },
    "detail": "Recorded: 10,153 in the answer bank and 5 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 10,158 recorded answers",
    "workbook_corpus": {
      "cells": 5,
      "matched": 5
    }
  },
  "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#L242-L244"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/dates::environment",
        "catalogue/dates::system",
        "catalogue/dates::to_1900",
        "catalogue/dates::date_arg",
        "catalogue/dates::of_date",
        "ported/date_kernels::days_from_civil",
        "ported/date_kernels::civil_from_days",
        "ported/date_kernels::ymd_1900",
        "ported/date_kernels::serial_to_ymd"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/dates.rs#L242-L244",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 10,158 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.DAY.json",
  "name": "DAY",
  "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- **[YEAR](FUNC.YEAR.md), [MONTH](FUNC.MONTH.md)** — the sibling projections; together they invert\n  [DATE](FUNC.DATE.md).\n- **[DAYS](FUNC.DAYS.md)** — the confusable. `DAY` reads a component of one date; `DAYS` measures\n  the interval between two. The names are one character apart and the meanings are unrelated.\n- **[EOMONTH](FUNC.EOMONTH.md)** — `DAY(EOMONTH(s,0))` is the idiomatic \"how many days are in this\n  month\" formula, and is the standard way people discover the 1900 artefact by accident:\n  `DAY(EOMONTH(DATE(1900,2,1),0))` asks a question with two possible right answers.\n- **[WEEKDAY](FUNC.WEEKDAY.md)** — day *of week* rather than day *of month*, and the function\n  Microsoft's leap-year article names as the one that returns incorrect values before 1 March\n  1900.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n\n1. **Implement the artefact as a coordinate shift, once.** Convert serial to a proleptic Gregorian\n   day number by subtracting 1 for serials ≥ 61, do real calendar arithmetic, and special-case\n   serials 0 and 60 on the way out. Trying to teach a calendar library that 1900 was a leap year\n   corrupts every other computation that library performs.\n2. **Share the serial→(y,m,d) routine** with `YEAR` and `MONTH`; three separate derivations will\n   eventually disagree at serial 60.\n3. **Decide what `DAY(60)` returns and write it down.** It is the one value in this function that\n   a reasonable engineer could get \"right\" in two different ways, and it is therefore the first\n   thing a compatibility test should pin.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns a `Number`, documented as 1…31 for real calendar days.\n\n- **Fractional serials** are floored; time of day is discarded.\n- **Serial 60** is the diagnostic input for this whole category. If the implementation carries the\n  phantom leap day, `DAY(60)` is 29 and `DAY(59)`/`DAY(61)` are 28 and 1. If instead it delegates\n  to a real calendar without the shift, the answers slide by one. Nothing else in the date\n  category exposes the artefact this directly.\n- **Very large serials.** The battery's maximum-double row returns a number rather than an error;\n  see below.\n\n\n\n### Errors\n\n\nAs documented for this category:\n\n- `#NUM!` when `serial_number` is out of range for the workbook's date-base value; negative\n  serials are the unambiguous case.\n- `#VALUE!` when the argument will not convert to a number — ordinary coercion, not a `DAY` rule.\n- An error argument propagates.\n\n\n",
    "sources": "\n- Microsoft 365 support, **DAY function** —\n  <https://support.microsoft.com/en-us/office/day-function-8a7d1cbb-6c7d-4ba1-8aea-25c134d03101>.\n- Microsoft Learn, **Excel incorrectly assumes that the year 1900 is a leap year** —\n  <https://learn.microsoft.com/en-us/office/troubleshoot/excel/wrongly-assumes-1900-is-leap-year>.\n- [FUNC.DATE](FUNC.DATE.md) — the serial-number model and the 1900/1904 systems.\n- Handbook call-model chapter [02 coercion and lifting](../model/02-coercion-and-lifting.md).\n- `data/functions/FUNC.DAY.json`, `data/presence/FUNC.DAY.json`, `data/battery/FUNC.DAY.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 | 10,153 |\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.DAY.json).",
    "what-it-does": "\n`DAY` projects a date serial onto its day-of-month component: floor the serial, map `⌊serial⌋` to\na calendar day under the workbook's date system (see [FUNC.DATE](FUNC.DATE.md)), and return that\nday's day-of-month as an integer, documented as 1 through 31.\n\nOf the three decomposers this is the one where Excel's serial line stops agreeing with the\ncalendar. Serial 60 denotes 29 February 1900, a date that did not exist; the day-of-month it\nreports is 29 in a February that had 28 days. Serial 0 denotes a \"0 January 1900\" that is not a\nday at all. So the documented 1–31 range is the range for *real* days; the phantoms sit outside\nthe calendar the range describes.\n\n\n\n### Arguments\n\n\n`DAY(serial_number)` — one required argument, the date whose day-of-month is wanted.\n\nMicrosoft's category-wide guidance applies: pass a serial from [DATE](FUNC.DATE.md), from another\nformula, or from a cell already holding a date, rather than text, whose interpretation depends on\nthe locale's date order. Argument coercion is the ordinary scalar behaviour described in\n[coercion and lifting](../model/02-coercion-and-lifting.md).\n\nNote that `DAY` takes a *date*, not a day count. `DAY(45)` is the day-of-month of 14 February\n1900, not the number 45 reduced somehow — a confusion that shows up whenever someone reaches for\n`DAY` when they wanted [DAYS](FUNC.DAYS.md).\n\n\n"
  },
  "signature": {
    "display": "DAY(serial_number)",
    "parameters": [
      {
        "description": null,
        "name": "serial_number",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 1,
        "min": 1
      },
      "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": "Day of the month (1 to 31) of a date",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Converts a serial number to a day of the month",
        "microsoft_url": "https://support.microsoft.com/en-us/office/day-function-8a7d1cbb-6c7d-4ba1-8aea-25c134d03101"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "DAY"
        },
        {
          "locale": "bg-BG",
          "name": "DAY"
        },
        {
          "locale": "cs-CZ",
          "name": "DEN"
        },
        {
          "locale": "da-DK",
          "name": "DAY"
        },
        {
          "locale": "de-DE",
          "name": "DAY"
        },
        {
          "locale": "el-GR",
          "name": "DAY"
        },
        {
          "locale": "en-AU",
          "name": "DAY"
        },
        {
          "locale": "en-GB",
          "name": "DAY"
        },
        {
          "locale": "en-US",
          "name": "DAY"
        },
        {
          "locale": "es-ES",
          "name": "DAY"
        },
        {
          "locale": "et-EE",
          "name": "PÄEV"
        },
        {
          "locale": "fi-FI",
          "name": "PÄIVÄ"
        },
        {
          "locale": "fr-FR",
          "name": "DAY"
        },
        {
          "locale": "he-IL",
          "name": "DAY"
        },
        {
          "locale": "hr-HR",
          "name": "DAY"
        },
        {
          "locale": "hu-HU",
          "name": "DAY"
        },
        {
          "locale": "id-ID",
          "name": "DAY"
        },
        {
          "locale": "it-IT",
          "name": "DAY"
        },
        {
          "locale": "ja-JP",
          "name": "DAY"
        },
        {
          "locale": "ko-KR",
          "name": "DAY"
        },
        {
          "locale": "lt-LT",
          "name": "DAY"
        },
        {
          "locale": "lv-LV",
          "name": "DAY"
        },
        {
          "locale": "nb-NO",
          "name": "DAG"
        },
        {
          "locale": "nl-NL",
          "name": "DAY"
        },
        {
          "locale": "pl-PL",
          "name": "DAY (dzień)"
        },
        {
          "locale": "pt-BR",
          "name": "DAY"
        },
        {
          "locale": "pt-PT",
          "name": "DIA"
        },
        {
          "locale": "ro-RO",
          "name": "DAY"
        },
        {
          "locale": "ru-RU",
          "name": "DAY"
        },
        {
          "locale": "sk-SK",
          "name": "DEŇ"
        },
        {
          "locale": "sl-SI",
          "name": "DAN"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "DAN"
        },
        {
          "locale": "sv-SE",
          "name": "DAY"
        },
        {
          "locale": "th-TH",
          "name": "วัน"
        },
        {
          "locale": "tr-TR",
          "name": "GÜN"
        },
        {
          "locale": "uk-UA",
          "name": "ДЕНЬ"
        },
        {
          "locale": "vi-VN",
          "name": "DAY"
        },
        {
          "locale": "zh-CN",
          "name": "DAY"
        },
        {
          "locale": "zh-HK",
          "name": "DAY"
        },
        {
          "locale": "zh-TW",
          "name": "DAY"
        }
      ],
      "signature": {
        "display": "DAY(serial_number)",
        "parameters": [
          {
            "description": null,
            "name": "serial_number",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "DAY",
      "version_marker": null,
      "xlcall": {
        "code": "67",
        "symbol": "xlfDay"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/day-function-8a7d1cbb-6c7d-4ba1-8aea-25c134d03101"
  },
  "try_it": {
    "formula": "=DAY(45000)"
  },
  "url": "https://handbook.dnacalc.com/functions/DAY.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "10,153 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.DAY.json"
      ]
    }
  ]
}