DAYS Function (LibreOffice Calc)

Date & Time Beginner LibreOffice Calc LibreOffice 4.0

The DAYS function returns the number of days between two dates. It is a modern, simple alternative to DATEDIF for day-based interval calculations.

The **DAYS** function returns the number of days between two dates. It is a modern, fully documented alternative to DATEDIF for day-based interval calculations. DAYS is ideal for durations, countdowns, deadlines, and any workflow requiring a simple day difference.

What the DAYS Function Does

  • Returns the number of days between two dates
  • Accepts real dates or serial numbers
  • Supports text dates when converted with DATEVALUE
  • Returns positive or negative values depending on order

It is designed to be simple, predictable, and ideal for day-based calculations.

Syntax

DAYS(end_date; start_date)

Arguments

  • end_date:
    The later date (or the date you are counting to).

  • start_date:
    The earlier date (or the date you are counting from).

Basic Examples

Days between two dates

=DAYS("2024-05-10"; "2024-05-01")

Returns 9.

Using cell references

=DAYS(B1; A1)

Negative result (if dates reversed)

=DAYS("2024-05-01"; "2024-05-10")

Returns -9.

Using DATEVALUE for text dates

=DAYS(DATEVALUE(A1); DATEVALUE(B1))

Advanced Examples

Days until a deadline

=DAYS(A1; TODAY())

Days since a start date

=DAYS(TODAY(); A1)

Days between dynamic month boundaries

=DAYS(EOMONTH(A1;0); EOMONTH(A1;-1))

Days in the current month

=DAYS(EOMONTH(TODAY();0); DATE(YEAR(TODAY()); MONTH(TODAY()); 1)) + 1

Days between fiscal year boundaries

=DAYS(DATE(YEAR(A1)+1;4;1); DATE(YEAR(A1);4;1))

Days between two timestamps (ignoring time)

=DAYS(INT(A1); INT(B1))

Days between ISO date strings

=DAYS(DATEVALUE("2024-03-15"); DATEVALUE("2024-01-01"))

Days between Excel serial dates imported as text

=DAYS(DATE(1899;12;30)+VALUE(A1); DATE(1899;12;30)+VALUE(B1))

Edge Cases and Behavior Details

DAYS returns a number, not a date

=TYPE(DAYS("2024-01-02"; "2024-01-01")) → 1 (number)

DAYS accepts:

  • Real dates
  • Serial numbers
  • Text dates (if recognized)
  • DATEVALUE outputs

DAYS does not require end_date ≥ start_date

Negative values are allowed.

DAYS ignores time components

=DAYS("2024-01-02 23:59"; "2024-01-01 00:01") → 1

Invalid text → Err:502

DAYS of an error → error propagates

Common Errors and Fixes

Err:502 — Invalid argument

Cause:

  • Text not recognized as a date
  • Non-numeric values
  • Mixed formats

Fix:

  • Wrap with DATEVALUE
  • Clean text with TRIM or SUBSTITUTE

Wrong result due to time components

Fix:

  • Wrap with INT() to strip time

Negative result unexpected

Fix:

  • Reverse argument order

Best Practices

  • Use DAYS for simple day differences
  • Use DATEDIF for mixed-unit intervals (Y/M/D)
  • Use NETWORKDAYS for business-day differences
  • Use DATEVALUE to normalize text dates
  • Strip time with INT() when needed
DAYS is your clean, modern day-difference tool — perfect for countdowns, durations, and any workflow where you want a simple, reliable day count.
  • Use DATEDIF for years/months/days
  • Use NETWORKDAYS for business days
  • Use WORKDAY for date offsets
  • Use YEARFRAC for fractional-year differences
  • Use DATE for constructing comparison dates

By mastering DAYS and its companion functions, you can build powerful, accurate, and fully dynamic date‑interval workflows in LibreOffice Calc.


Reproducible example (tested in LibreOffice Calc)

This standalone example was calculated in LibreOffice Calc 25.2.3.2 and matched the expected value. It is a practical cross-check of one usage, not proof that every example elsewhere on this page is correct.

=DAYS(DATE(2025;1;10);DATE(2025;1;1))

Expected result: 9.

Calculate the number of days between two dates.

If the result differs, check the referenced cells, argument separators and number formatting. For more information, consult the LibreOffice Calc official help.