Expand my Community achievements bar.

Join us LIVE in San Francisco on November 14th for Experience Makers The Skill Exchange. Don't miss out on this free learning event!

Datediff results displaying -1 when dates are the same

Avatar

Level 2

I have a calculated field on a custom form to calculate the days between a custom date field on a project and the planned completion date of that project. However, when those two dates are the same, the formula is showing a result of -1. I have attempted rounding, adding a day, and setting an if statement to display "0" if the dates are the same but I am not having any luck with those. They either aren't working at all (presumably a syntax error) or they are displaying inconsistent results. 

 

My goal is to have a number of days, rounded to the nearest whole number. But, for it to display "1" if the difference is truly one day, "0" if it's the same day, etc. 

 

Here is the calculation that I am currently working with: 

ROUND(DATEDIFF({DE:TM10 Date - Approved},{plannedCompletionDate}),IF({DE:TM10 Date - Approved}={plannedCompletionDate},"0"))
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Community Advisor

The calculated data expressions page has a list of functions you can try -- I'm wondering if maybe you have tried CLEARTIME.

https://experienceleague.adobe.com/en/docs/workfront/using/reporting/reports/calculated-custom-data/...

 

If your custom field is just a date field and not time field, you could maybe just go with DATEDIFF({DE:TM10 Date - Approved},CLEARTIME({plannedCompletionDate}))