The following function returns the time difference in the format h:nn:ss
Public Function TimeDuration(dtmFrom As Date, dtmTo As Date) As String
Const HOURSINDAY = 24
Dim strDays As String
Dim strMinutesSeconds As String
Dim dblDuration As Double
dblDuration = dtmTo - dtmFrom
'get number of days
strDays = Int(dblDuration) * HOURSINDAY + _
Format(dblDuration, "h")
' get minutes and seconds
strMinutesSeconds = Format(dblDuration, ":nn:ss")
TimeDuration = strDays & strMinutesSeconds
End Function
Call it like so:
=TimeDuration([Date&Time Start], [Date&Time Off])
Ken Sheridan
Stafford, England
dos1970 said:
How to calculate a difference between Dates in hours & minutes?
There are [Date&Time Start], [Date&Time Off] and [WorkTime]. How to
calculate a difference between [Date&Time Start] and [Date&Time Off] in
hours & minutes in [WorkTime]?