Why are all my DATETIME_DIFF formulas coming up as a negative number?

My formula is: DATETIME_DIFF({Birthday}, TODAY(), ‘years’) and I am getting for example -29 instead of 29.

Why are all my DATETIME_DIFF formulas coming up as a negative number?

My formula is: DATETIME_DIFF({Birthday}, TODAY(), ‘years’) and I am getting for example -29 instead of 29.

Because TODAY() needs to go first. Formula documentation is here:

I tried that, but I get the error message.

Using: DATETIME_DIFF(TODAY(),{Birthday},‘years’)

Are you using the correct quotation marks?

`DATETIME_DIFF(TODAY(),{Birthday},'years')`

Yup… I also have the same issue with this formula (getting a negative number).

DATETIME_DIFF({Check-in}, {Check-out},‘days’)

Once again, you’re doing it incorrectly. As I explained above, you need to put the later date first, not the earlier date first.

If you’re getting an error message, than please explain what error message you’re getting and please give a screenshot to go with it.

You’re not giving enough information for us to help you. We can’t just guess what sort of error you’re getting.

Ok, so it worked with this formula putting the date first: DATETIME_DIFF({Check-out}, {Check-in}, ‘days’).

But for this formula: DATETIME_DIFF(TODAY(),{Birthday},‘years’) and DATETIME_DIFF(TODAY(), {Birthday}, ‘years’)

I got the attached error message.

It’s because, as @Mohamed_Swellam pointed out above, you are using stylized quotation marks around the word years. Airtable only recognizes straight quotes, not curly quotes.

2 Likes

Strange - they have worked for other formulas just fine.

I figured it out it didn’t like the curly braces.

Used: DATETIME_DIFF(TODAY(), Birthday, ‘years’)

Thank you!

No, the curly braces had nothing to do with it. It was the quotation marks that were the problem.

2 Likes

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.