Expand my Community achievements bar.

The next phase for Workfront Community ideas is coming soon. Learn all about it in our blog!
SOLVED

DateDiff Variable Not Calculating Correctly

Avatar

Level 10

Hi Fusion folks,

I have a filter on a Fusion scenario path that looks to see if the variable called DateDif is > 0.  If so, let'er through.  However, for some reason, I'm getting a zero when it calculates the datediff, when I would expect it to be "1".  I'm not sure why this is.  Here's the scoop:

 

This is the variable module responsible for formatting NOW, and a date output from a previous module

Format Dates.png

 

Here is the result

Format Dates Result.png

 

Here is the variable module responsible for doing the datediff calc

DateDiff Calc.png

 

Here is the result:

DateDiff Result.png

 

The odd thing is that some records flow through fine, while others do not.
Does anyone know what I might be missing here?  

Thanks,

Nick

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Heather!
Yeah, it appears so.


Per Support:

It looks at the full date, so it would only evaluate to true if there is at least 1 month difference between the 2 dates. 

If the 2 dates are 02/19/2023 and today, the calculation would be true
If the 2 dates are 02/21/2013 and today, the calculation would be false

Would it be a suitable option to change the comparison unit to milliseconds, seconds, minutes, hours, days, or weeks in order to satisfy the condition?

I ended up needing to change my evaluation to days, not months.
Cheers.
Nick

View solution in original post

3 Replies

Avatar

Level 10

Would it matter if the date value that it's capturing from a previous module is not exactly 1 month or greater compared to NOW?

 

Example:

- It grabs the date 2023-02-01 from a previous API call module to Salesforce (asset)

- My first variable module converts that date into MM/YYYY (02/2023).  That same variable module also converts NOW into MM/YYYY (03/2023)

- My next variable module does the date difference between these two values: 03/2023 - 02/2023 = 1

- My next filter says ok, this is greater than 0, so you can move through to the subsequent modules

 

My question is whether the date dif function is really just looking at the formatted dates (MM/YYYY), or if it's looking at the full dates (2023-02-01 and 2023-03-20)?  If it's looking at the full dates when doing the datdiff comparison, than in some cases, if I have a Salesforce record date of say 2023-02-25, the datediff when compared to the full date of NOW will be less than 1 (and round to 0).

Could this be my problem?

Avatar

Community Advisor

I suspect even though you've got it formatted to output MM/YYYY, it looks at the full date for the calculation. And may even look at the time associated with the date as well. 

Avatar

Correct answer by
Level 10

Hi Heather!
Yeah, it appears so.


Per Support:

It looks at the full date, so it would only evaluate to true if there is at least 1 month difference between the 2 dates. 

If the 2 dates are 02/19/2023 and today, the calculation would be true
If the 2 dates are 02/21/2013 and today, the calculation would be false

Would it be a suitable option to change the comparison unit to milliseconds, seconds, minutes, hours, days, or weeks in order to satisfy the condition?

I ended up needing to change my evaluation to days, not months.
Cheers.
Nick