I believe the function you are after is DateDiff
eg;
dim StartTime as Date
dim EndTime as Date
dim NumHours as Integer
dim NumMinutes as Integer
StartTime="08:00" 'eg 8am
EndTime="14:30" 'eg 2:30pm
NumHours=DateDiff("h",StartTime,Endtime)
NumMinutes=Datediff("n",StartTime,EndTime)
'this will return 6 hours, and 390 minutes.
'to get the actual hours and minutes we need to take
'60x6 away from 390...
NumMinutes=NumMinutes-(60*NumHours)
Msgbox "Time Elapsed: " & NumHours & "hrs " & NumMinutes & "mins"
Basically, you use the DateDiff function like this;
[var]=DateDiff("[type]",[start],[end])
where [type] =
[d] = days
[m] = months
[y] = years
[h] = hours
[n] = minutes
[s] = seconds
..there's more - look it up in the help.




Reply With Quote