IF statements to check if a date has been changed in 14 days

Hey all! Trying to figure something out.

I am pulling a date from a table called 'date changed'. I am trying to check if that date was changed more than 14 days ago. If its been changed in the last 14 days, no issues. If it hasnt been changed in 14 days, then output something. Ive tried the code below and it seems to be converting my date into a number? Just trying to figure out what to do

Date of last Substance use assessment: {=date changed} {if: date changed > {time: 'YYYY-MM-DD' shift=-14D}}Yes{else}No{endif}

Hi!

The datetimediff function would be helpful for this.

Here is an example:

{datechanged="2024-12-09"}
{if: datetimediff(datechanged, {time: YYYY-MM-DD}, "D") <=14}
Changed in the last 14 days!
{else}
Not changed in the last 14 days
{endif}

Check out the Date Time Functions section of the formula reference:

hmmm that does not seem to work....

If I put it as written above, my code looks like this:


Then running the code gives me this

error2

If I change "datechanged" to "date changed" so it looks like this...

I get this error

Thanks for your help on this.... I think the issue is its pulling the date from Datablaze and its causing some issues... but you might know better than me.

Happy holidays :slight_smile:

Hi @bkoch you're on the right track. One small change, in the latest example, you need to write:

{if: datetimediff(`date changed`, ...

Notice the backtick symbols (`) around the name. We need to put those backticks as the name has spaces.
Let us know if it works for you.

That worked! Took me a bit to get the right (`) as I was using ('). thanks muchly!