Unable to use datediff function in Apache OpenOffice Calc

2

I am unable to get a result by using the command =DATEDIFF('dd', '2007-08-01', '2007-09-01') in Apache OpenOffice Calc.

Even using two columns of dates and using the formula =DATEDIFF('dd','A2','B2'), I am unable to find the difference between dates.

How can I fix this?

beginner

Posted 2012-06-19T05:18:41.560

Reputation: 21

Answers

1

DATEDIFF seems to be OpenOffice Base/SQL function, not Calc function. It can be used in Calc as Basic macro custom function.

ristoi

Posted 2012-06-19T05:18:41.560

Reputation: 11

0

=YEARS(C6;$C$3;0)&" Years, "&((MONTHS(C6;$C$3;0))-(YEARS(C6;$C$3;0)*12))&" Month, "&(ROUNDDOWN((DAYS($C$3;C6))-(YEARS(C6;$C$3;0)*365)-(((MONTHS(C6;$C$3;0))-(YEARS(C6;$C$3;0)*12))*30);0)&" Day")

Note: $C$3 can be replace by =Now()

Nanang

Posted 2012-06-19T05:18:41.560

Reputation: 1

1Can you expand your answer a little to explain how this works? Thanks. – fixer1234 – 2016-06-13T03:37:35.060

0

There's no function named DATEDIFF available from the OpenOffice Calc Date & Time funstions.

Instead, you should use the Calc-specific funtions, for example the DAYS function to calculate the number of days between two dates:

=DAYS("2007-08-01", "2007-09-01")

EDIT: Regarding DATEDIFF: this is a function that's part of the Core SQL:1999 standard (see the overview of date/time sql functions in the SQL Wikibook), so you can use it with most SQL databases (OpenOffice Base, MySQL, PostgreSQL and so on). But you can't use a SQL function natively in Calc.

tohuwawohu

Posted 2012-06-19T05:18:41.560

Reputation: 8 627

I think there should be double quotes around the dates in your example. – PleaseStand – 2012-06-19T06:45:08.363

@PleaseStand: thank you for the hint, you were right. – tohuwawohu – 2012-06-19T16:27:22.163