I’m trying to calculate the number of days between 2 dates. One of the dates is not in my data set and is constant (9/30/18). The other date that’s in my data set. What’s the best way do that?
Solved! Go to Solution.
The DateTimeDiff( function can tell you the difference between two date value in an increment you specify. Here's the syntax:
DateTimeDiff(dt1,dt2,u)
Where dt1 and dt2 are two datetime values, and u is the units. The date values can be a variable input (as long as it's in the correct format), or static values. If your input dates are in a field called [Date] then you can calculate the difference in days from 2018-09-30 using this formula:
DateTimeDiff([Date],"2018-09-30","days")
Note that "2018-09-30" is the standard date format that Alteryx uses and is necessary for these date calculations. Let me know if you have any questions.
Thanks, that worked. If I then wanted to take that number and divide by 365, how is that done?
I figured it out....ToNumber([Days])/365