Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Community v19.9

The latest release includes several enhancements designed to improve your Community experience!

Learn More

DateTimeDiff() function using hours, minutes


I am unable to get the desired results with this function. I have a simple operation.  See below for a couple of examples:

DateTimeDiff(2015-01-29 06:00:00, 2015-01-28 13:15:00,   'hours') + DateTimeDiff(2015-01-29 06:00:00, 2015-01-28 13:15:00,   'minutes')/60 = 32.75   This clearly should be 16.75

DateTimeDiff(2015-01-28 09:15:00, 2015-01-28 06:00:00, 'hours') + DateTimeDiff(2015-01-28 09:15:00, 2015-01-28 06:00:00, 'minutes')/60 = 6.25        This clearly should be 3.25


Please tell me what I am doing wrong.




The DateDiff function is giving you the total number or hours (16) and total number of minutes (1005)


I think the formula you want is:


DateTimeDiff([Field1], [Field2], "minutes")/60

Where Field1 and Field2 are your dates 


Yes, of course. I was double counting.  Thank you.


check this workflow

the probleom with your logic is you are dividing the Mins by 60 instead Modulo

i think the one i attached should work :)




I was suggesting just using DateTimeDiff(...minutes)/60 and forgetting the hours part as no need to do it twice.

so, How it will behave for the below dates

2015-01-28 06:00:00

2015-01-28 07:15:00

Should it be 1 hr 15 Mins or 1 Hr 25 Mins?


1.25 hours, which is what i want.  I dount want hours and minutes, which your modulo function would allow.

Alteryx Certified Partner

Hi Peter,


To find the difference in hours between the two (which i assume was what your desired output was?), i just used the second part of the expression.


DateTimeDiff(2015-01-29 06:00:00, 2015-01-28 13:15:00, 'minutes')/60 = 16.75

DateTimeDiff(2015-01-28 09:15:00, 2015-01-28 06:00:00, 'minutes')/60 = 3.25


If i've understood your question correctly, there isn't a requirement for the DateTimeDiff hours function. In the case of your formula, it is simply adding the difference in hours onto you result which has caused your outcome to be higher than expected.



I've read through this discussion and still am confused as I am not getting the correct answers.

I have 3 cases shown here and used 3 variations of the DateTimeDiff function.

My goal is to calculate the number of minutes between the 2 given dates.

When I check this with Excel, none of these are matching up.

Would someone please help me get this correct?
Thanks. Samuel Young