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.
Request clarification before answering.
I'm pretty sure I got the logic right on this one, it's been a while but excusing typos, this should do it in one line.
iif(totext(DateDiff ("n",{@DateTimeRecd},{@DateTimeRtd}) \ 60)>0, totext(DateDiff ("n",{@DateTimeRecd},{@DateTimeRtd}) \ 60) + " Hours and ","") + iif(DateDiff ("n",{@DateTimeRecd},{@DateTimeRtd}) mod 60 <= 0, "No Minutes", totext(DateDiff ("n",{@DateTimeRecd},{@DateTimeRtd}) - (DateDiff ("n",{@DateTimeRecd},{@DateTimeRtd}) \ 60)) + " minutes")
Thanks,
Zach
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried this and get a message stating a string is required. It then highlights the 0 directly after the > in the first statement.
iif(totext(DateDiff ("n",{@DateTimeRecd},{@DateTimeRtd}) \ 60)>0, totext(DateDiff ("n",{@DateTimeRecd},{@DateTimeRtd}) \ 60) + " Hours and ","") + iif(DateDiff ("n",{@DateTimeRecd},{@DateTimeRtd}) mod 60 <= 0, "No Minutes", totext(DateDiff ("n",{@DateTimeRecd},{@DateTimeRtd}) - (DateDiff ("n",{@DateTimeRecd},{@DateTimeRtd}) \ 60)) + " minutes")
| User | Count |
|---|---|
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.