Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am unable to get a result by using this 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.

Can anyone help me out?

share|improve this question

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

share|improve this answer

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.

share|improve this answer
I think there should be double quotes around the dates in your example. – PleaseStand Jun 19 '12 at 6:45
@PleaseStand: thank you for the hint, you were right. – tohuwawohu Jun 19 '12 at 16:27

=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()

share|improve this answer
Can you expand your answer a little to explain how this works? Thanks. – fixer1234 Jun 13 at 3:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .