cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

I'm trying to return the difference in hours and minutes between two DateTime fields.

I'm currently using the following

DateDiff ("n",{@DateTimeRecd},{@DateTimeRtd})

However, this only returns the number of mintues. Of course I can change it to DateDiff ("h",{@DateTimeRecd},{@DateTimeRtd}), but this is only hours.

I'm needing the time in hours and minutes.

Any ideas?

Thank you in advance for your assistance.

0 Likes
View Entire Topic
Former Member
0 Likes

I figured this out by using the following formula. This will return number of days; hours and minutes.

CStr (int(Truncate (DATEDIFF('n',{@DateTimeRecd},{@DateTimeRtd}) /1440 ))) & "D " &

CStr (int(Remainder(Truncate (DATEDIFF('n',{@DateTimeRecd},{@DateTimeRtd}) /60 ),24))) & "H " &

CStr (int(Remainder(DATEDIFF('n',{@DateTimeRecd},{@DateTimeRtd}),60)))& "M "

I appreciate everyones assistance.

Former Member
0 Likes

Be very carefull with DateDiff. It's not dependable. DateAdd is better. I think that's one of the reasons that Luk showed it to you.

The best,

The Panda