cancel
Showing results for
Search instead for
Did you mean:

# Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
###### #SANTALYTICS

Gather all 9 clues to complete the final Weekly Challenge on Dec 16!

Learn More
SOLVED

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

Highlighted
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.

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