Does anybody can help me calculate time which more than 24 hours? :confused:
I had used
DateDiff("n",[time attend],[time finished]).
It does not give me the correct answer when somebody attend it at 21:45 and finished at 05:30 the next day.
Printable View
Does anybody can help me calculate time which more than 24 hours? :confused:
I had used
DateDiff("n",[time attend],[time finished]).
It does not give me the correct answer when somebody attend it at 21:45 and finished at 05:30 the next day.
What answer do you get ?Quote:
Originally posted by afifudin
Does anybody can help me calculate time which more than 24 hours? :confused:
I had used
DateDiff("n",[time attend],[time finished]).
It does not give me the correct answer when somebody attend it at 21:45 and finished at 05:30 the next day.
try this
--Hours
SELECT (#1-18-2004 05:30:00#-#1-17-2004 21:45:00#)*24
--Minutes
SELECT (#1-18-2004 05:30:00#-#1-17-2004 21:45:00#)*24*60
--Seconds
SELECT (#1-18-2004 05:30:00#-#1-17-2004 21:45:00#)*24*60*60
I believe your answer is displayed back to you in minutes and seconds instead of hours and minutes... so you could do something like this.
=Int([Duration]/60) & "hour(s) and " & ([Duration])-((Int([Duration]/60))*60) & "minute(s)"
where [duration]= DateDiff("n",[time attend],[time finished]).
I forget why I needed the Int, so you may or may not need that and technically you could just paste your formula everywher it says duration. All this does is divide the duration by 60 to get you hours and then gives you the remainder by subtracting the hours from total and leaving only the leftover remainder minutes. You could just as easily replace hours and minutes and put back in the hh:mm format.
The output in my report having -975min which is not true. the true answer is 465min. I'm going to try some other method replied by others & keep you all posted.