Difference Between Two Dates in Real Units (DAYS)

Syntax: DAYS(t1; t2)

The DAYS function calculates the number of days between two dates. For example:

=DAYS("12/15/2010"; NOW())

returns –383.93, on Nov. 26, 2009 at 1:35 a.m.

You can give DAYS the date in a more natural format:

=DAYS(DATE(2010; 12; 15); NOW())
images

Figure 12-13. Sample result of the DAYS function

The minus sign appears in the result because OpenOffice.org Calc always subtracts t2 from t1 (t1 – t2).

Remember that you can remove the minus sign with the ABS function, but you need to watch out for errors that such shortcuts may introduce to your calculations:

=ABS(DAYS("12/15/2010"; ...

Get Beginning OpenOffice Calc: From Setting Up Simple Spreadsheets to Business Forecasting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.