DATEDIFF examples please


I’ve been doing many variants of this:
SELECT case_number, DATEDIFF(DAY,NOW(),date_open) from case_open;

Nothing is working.

Can anyone provide a few examples of proper ways to use DATEDIFF please.


@davidrubert can you provide a few sample rows of data?


Hi @davidrubert, DAY needs to be in single quotes, i.e. SELECT case_number, DATEDIFF('DAY',NOW(),date_open) from case_open;

I noticed that we don’t document the need for single quotes so will notify the doc team. Sorry for any inconvenience!



thanks @darwin! i checked the docs and didn’t see anything amiss in the query. nice catch!


Thank you Darwin and easy. That was the magic.