Tim Ferguson said:
OutTime = Int((EndDate - StartDate) * 24)
Just a thought
Tim F
Tim F,
That function was actually a shorted version of:
Public Function ElapsedTimeBetween(StartDate As Date, EndDate As
Date) As String
' Created: 12/28/2005
'
' Function to determine the elapsed time, in hours, minutes,
' and seconds, between two given times.
'
' StartDate must be less than EndDate.
'
' When this function returns "-1", StartDate was less than
' EndDate, and an error has occured.
'
Dim SecondsElapsed As Long
Dim HoursFromSeconds As Long
Dim MinutesFromSeconds As Long
Dim SecondsRemaining As Long
Dim OutTime as String
SecondsElapsed = DateDiff("s", StartDate, EndDate)
If SecondsElapsed < 1 Then
OutTime = "-1"
Else
HoursFromSeconds = SecondsElapsed \ 3600
MinutesFromSeconds = (SecondsElapsed Mod 3600) \ 60
SecondsRemaining = (SecondsElapsed Mod 3600) Mod 60
OutTime = Format(HoursFromSeconds, "00") & ":" & _
Format(MinutesFromSeconds, "00") & ":" & _
Format(SecondsRemaining, "00")
End If
ElapsedTimeBetween = OutTime
End Function
With some of the lines cut out.
And yes, there are other ways of writing out the calculations.
Sincerely,
Chris O.