If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Time Difference 24 Hours
I need to determine the difference in hours between two events.
DateDiff("d" [CollectDate],[DueDate]) gives me the difference in days and DateDiff("h",format(CollectDate,"hh:mm"),format(Du eDate,"hh:mm")) gives me the difference in hours, but I need to know the total hours between the two entries. For example: CollectDate/Time DueDate/Time DifferenceInHours 1/1/08 12:00 AM 1/3/08 12:00 AM 48 Hours (or whatever it is) Does anyone know the formula for returning just the hours portion of the difference, or, in the alternative, how to convert what I have above to just hours. Any help would be greatly appreciated. |
#2
|
|||
|
|||
Time Difference 24 Hours
Awww.... you're so close.
Get the difference in minutes, then use integer division. DateDiff("n",StartDateTime, EndDateTime) returns the number of minutes between the two time points. Then just use division to get the number of hours. DateDiff("n",StartDateTime, EndDateTime)\60 = hours only DateDiff("n",StartDateTime, EndDateTime)/60 = hours and minutes (well, 100ths of an hour). You could use MOD to get the remaining minutes |
#3
|
|||
|
|||
Time Difference 24 Hours
Awww...you're so Awesome - worked like a charm. Thank you so much!
" wrote: Awww.... you're so close. Get the difference in minutes, then use integer division. DateDiff("n",StartDateTime, EndDateTime) returns the number of minutes between the two time points. Then just use division to get the number of hours. DateDiff("n",StartDateTime, EndDateTime)\60 = hours only DateDiff("n",StartDateTime, EndDateTime)/60 = hours and minutes (well, 100ths of an hour). You could use MOD to get the remaining minutes |
Thread Tools | |
Display Modes | |
|
|