curatedapi
Browse the docs

Guides

Finance

Excel functions

Late payments

E-invoices

Accounting

Number checks

VAT and GST

Billing and pricing

Money and currencies

Dates and time

Math

Unit conversion

Everyday

Health

Excel DAYS360 function: days on a 360-day year API

Days between two dates on a 360-day year, by the US (NASD) or European method, as Excel's DAYS360.

POST https://api.curatedapi.com/v1/calc/excel/days360

DAYS360(start_date, end_date, [method]). US method (false): a start date on the last day of a month becomes the 30th; an end date on the 31st becomes the 1st of the next month if the start day is before the 30th, otherwise the 30th. European method (true): every 31st becomes the 30th.

Formula

360·(y₂ − y₁) + 30·(m₂ − m₁) + (d₂ − d₁), after the method's adjustments
  • Arguments are named and ordered as in Excel. Excel computes in binary floating point; this API computes the exact value of the same formula and rounds it once, so it agrees with Excel to the digits Excel can show, and where Excel's own rounding error reaches the 15th digit this answer is the correct one.
  • Dates are ISO 8601 (YYYY-MM-DD) from 1900-03-01 to 9999-12-31, so Excel's fictional 29 February 1900 never comes into play. Each date result also gives Excel's serial number (1900 date system).

Inputs

Send numbers as strings to keep every digit. options sets precision and rounding (see numbers and rounding).

InputTypeDescription
start_date required date (YYYY-MM-DD) Start date.
end_date required date (YYYY-MM-DD) End date.
method boolean
default False
false: US (NASD) method; true: European method.
options.rounding half_even | half_up | half_down | up | down | ceiling | floor Rounding mode applied once to each result. Default half_even.
options.decimals integer Round results to this many digits after the decimal point.
options.significant_digits integer Round results to this many significant digits.

Result

Under result in the answer, next to exactness, precision, inputs, formula, references and warnings.

ResultTypeDescription
daysintegerDays on a 360-day year (negative if end is before start).

Examples

Microsoft's example: 30 January to 1 February 2011

Requestcurl
curl https://api.curatedapi.com/v1/calc/excel/days360 \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "start_date": "2011-01-30",
    "end_date": "2011-02-01"
  }'
200 OKResponse
{
  "calculator": "excel/days360@1",
  "result": {
    "days": 1
  },
  "exactness": {},
  "precision": {
    "rounding": "half_even",
    "decimals": 0
  },
  "inputs": {
    "start_date": "2011-01-30",
    "end_date": "2011-02-01",
    "method": false
  },
  "formula": "360·(y₂ − y₁) + 30·(m₂ − m₁) + (d₂ − d₁), after the method's adjustments",
  "references": [
    {
      "title": "Microsoft Excel DAYS360 function",
      "url": "https://support.microsoft.com/en-us/excel/functions/days360-function"
    }
  ],
  "warnings": []
}

Microsoft's example: the whole of 2011

Requestcurl
curl https://api.curatedapi.com/v1/calc/excel/days360 \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "start_date": "2011-01-01",
    "end_date": "2011-12-31"
  }'
200 OKResponse
{
  "calculator": "excel/days360@1",
  "result": {
    "days": 360
  },
  "exactness": {},
  "precision": {
    "rounding": "half_even",
    "decimals": 0
  },
  "inputs": {
    "start_date": "2011-01-01",
    "end_date": "2011-12-31",
    "method": false
  },
  "formula": "360·(y₂ − y₁) + 30·(m₂ − m₁) + (d₂ − d₁), after the method's adjustments",
  "references": [
    {
      "title": "Microsoft Excel DAYS360 function",
      "url": "https://support.microsoft.com/en-us/excel/functions/days360-function"
    }
  ],
  "warnings": []
}

Microsoft's example: 1 January to 1 February 2011

Requestcurl
curl https://api.curatedapi.com/v1/calc/excel/days360 \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "start_date": "2011-01-01",
    "end_date": "2011-02-01"
  }'
200 OKResponse
{
  "calculator": "excel/days360@1",
  "result": {
    "days": 30
  },
  "exactness": {},
  "precision": {
    "rounding": "half_even",
    "decimals": 0
  },
  "inputs": {
    "start_date": "2011-01-01",
    "end_date": "2011-02-01",
    "method": false
  },
  "formula": "360·(y₂ − y₁) + 30·(m₂ − m₁) + (d₂ − d₁), after the method's adjustments",
  "references": [
    {
      "title": "Microsoft Excel DAYS360 function",
      "url": "https://support.microsoft.com/en-us/excel/functions/days360-function"
    }
  ],
  "warnings": []
}

References

Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.

Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.