Contact

DAYS Function (OpenOffice Calc)

Date & Time Intermediate OpenOffice Calc

Subtract dates with DAYS in Apache OpenOffice Calc, including reversed dates, leap years and fractional-day timestamps. See eight checked examples.

Verification status: Eight ordinary reference formulas were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816, through generated native ODF and GUI hard recalculation. Saved identities and results were checked. How formula examples are checked

Quick answer: =DAYS(DATE(2024;3;1);DATE(2024;2;28)) returned 2 in the tested Apache OpenOffice 4.1.16 build.

Availability and version history

  • Introduced: First release not established; documented by OpenOffice.org 3.3.
  • Supported in: Apache OpenOffice 4.1.16; this is a verified release, not a final supported version.
  • Scope: Desktop Calc, English function names and semicolon-separated formulas.
  • Checked: October 14, 2026. Eight ordinary reference formulas were recalculated from generated ODF in 4.1.16 on Linux x86-64, Build 9816. Source and independent calendar arithmetic were checked.

What DAYS returns

DAYS returns the first numeric date/time value minus the second. Positive results mean the first value is later. Because the implementation subtracts the numbers directly, time fractions remain in the result. It counts elapsed days, rather than occupied calendar dates, business days or a financial 30-day convention. Release implementation.

Syntax and arguments

DAYS(EndDate;StartDate)
  • EndDate: the later endpoint for a positive elapsed duration.
  • StartDate: the starting endpoint. Both arguments are required.
  • Use actual date cells or DATE(year;month;day). Unquoted arithmetic such as 2024/3/1 is division, not a date literal.

Eight reproducible examples

The native column contains saved 4.1.16 results; independent references use exact date arithmetic or rational fractions. Numerical values are shown to twelve decimal places where needed. Enter the DATE expressions directly rather than substituting locale-dependent text.

Formula Native 4.1.16 result Independent reference
=DAYS(DATE(2024;3;1);DATE(2024;2;28)) 2 2
=DAYS(DATE(2023;3;1);DATE(2023;2;28)) 1 1
=DAYS(DATE(2024;1;31);DATE(2024;1;1)) 30 30
=DAYS(DATE(2024;1;1);DATE(2024;1;31)) -30 -30
=DAYS(DATE(2024;6;1);DATE(2024;6;1)) 0 0
=DAYS(DATE(2025;1;1);DATE(2024;1;1)) 366 366
=DAYS(DATE(2024;6;2)+0.5;DATE(2024;6;1)+0.25) 1.25 1.25
=DAYS(10.75;3.25) 7.5 7.5

Practical worksheet

Suppose A2 is =DATE(2024;1;1) and B2 is =DATE(2024;1;31). =DAYS(B2;A2) gives 30, the elapsed interval. If a clearly defined report counts both occupied calendar dates, add one and label the result 31 inclusive dates. Do not add one automatically to elapsed-time measurements.

For a start at June 1, 2024 at 06:00 and an end at June 2 at 12:00, the exact numeric inputs are DATE(2024;6;1)+0.25 and DATE(2024;6;2)+0.5. Their difference is 1.25 days, equivalent to 30 hours. Format the answer as a number, rather than a calendar date.

Advanced interpretation and checks

Subtraction gives useful consistency checks: DAYS(B;A)=-DAYS(A;B), DAYS(A;A)=0, and DAYS(C;A)=DAYS(C;B)+DAYS(B;A) for compatible numeric values. These identities concern the stored serials, so mixing date systems or time zones before import can invalidate the interpretation even when the arithmetic is correct.

For February 28 to March 1, the 2024 leap-year difference is 2; the 2023 difference is 1. A 366-day calendar year is not automatically the denominator for a contractual year fraction. Use the appropriate separate day-count convention.

Boundaries and troubleshooting

DAYS accepts numeric values without proving that they were originally entered as dates. The example DAYS(10.75;3.25)=7.5 demonstrates the arithmetic contract. A missing input cell can therefore be materially different from a deliberately entered date, even when a spreadsheet converts it to zero. Validate required dates before calculating.

The eight tests cover ordinary numeric dates and times. Text-date parsing, invalid arguments, other locales and extreme date limits were not executed. Avoid text dates whose month/day order depends on locale.

Official evidence and checking scope

The generated ODF produced the informational load warning “Not all attributes could be read.” The sheet was hard-recalculated and saved separately. All eight ordinary function identities and results were reconciled; a stale SUM cache changed from 999999 to 3 and an uncached SUM returned 7. This establishes the stated examples, not every workbook style or invalid input. Other explanatory identities are independent calculations. The authoring-tool XLSX was not executed in OpenOffice, and its preview values are not the native results reported here.