cancel
Showing results for
Did you mean:

# Alteryx designer Discussions

###### #SANTALYTICS

We will be upgrading the Gallery to our 2019.4 release this Saturday, December 7th beginning at 9:00am MT. We expect the outage to take last approx. 2.5 hours.
SOLVED

## Calculating days between 2 dates where one is a constant and not in the data set

Meteoroid

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?

Alteryx Certified Partner

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.

Highlighted
Meteoroid

Thanks, that worked. If I then wanted to take that number and divide by 365, how is that done?

Meteoroid

I figured it out....ToNumber([Days])/365

Labels