Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Subtracting 2 dates (with Time)

StephenM
6 - Meteoroid

Hello...  I'm trying to subtract 2 dates to find the differences (in days).  One date (I'm calling it Print Date) does not include time (ex 12/12/2019).  The 2nd date (I'm calling it Approval Date) includes time (ex. 12/13/2019 11:06 AM).  I'm using the DateTImeDiff function (DateTimeDiff([ApprovalDate],[PrintDate},"days"), but it's returning a value of 1.  I'm looking for it to return a decimal answer to include the 11 hours in the 2nd date.  So, in this example, i'm thinking the answer should be 1.4625.

 

Any suggestions?

3 REPLIES 3
DiganP
Alteryx Alumni (Retired)

@StephenM Attached is the workflow that creates the result.

 

What you need to do is use this formula: (DateTimeDiff([DateOut2],[DateOut1],'minutes'))/1440

 

Find the difference in minutes and divide it by 1440 (mins in a day). This gives you ~1.45

 

DiganP_0-1579027307178.png

Digan
Alteryx
danilang
19 - Altair
19 - Altair

hi @StephenM 

 

Use this formula 

 

datetimediff([ApprovalDate],[Printdate],"minutes")/(24*60)

 resulting in 

r.png

 

Dan

 

 

StephenM
6 - Meteoroid

Works perfectly.  Thank you very much!

Labels