How to convert decimal time from Date/Time calculation
StartTime and EndTime are Date/Time types
Dim ElpsdTime, EintMin, EintSec, EintTSec, As Double
Dim EintHr As Single
Dim intHr, intMin As Integer
ElpsdTime = CDbl(![EndTime] - ![StartTime])
intHr = Hour(ElpsdTime) 'Rounded Hours Function
txtHR = Str(intHr) 'String Hours ++++++++++++++++++++++
'++++++++++++++++++++++Hours
EintHR = ElpsdTime * 24 'Convert decimal to hours
'++++++++++++++++Minutes
intMin = Minute(ElpsdTime) 'Rounded Minutes function
txtMin = Str(intMin)
txtMin = LTrim(txtMin)
strLEN = Len(txtMin)
If strLEN = 1 Then
txtMin = (":0" + txtMin)
Else
txtMin = (":" + txtMin) 'String Minutes +++++++++++++++++
End If
'++++++++++++++++++++++Seconds
EintMin = (EintHR - intHr) 'Subtract Hours to get decimal minutes
EintMin = (EintMin * 60) 'Convert decimal minutes to minutes
EintSec = (EintMin) - intMin 'Subtract minutes to get Seconds
If EintSec <= 0 Then
EintSec = 0
EintTSec = 0
txtSec = ":00"
Else
EintSec = (EintSec * 60) ' Convert decimal to seconds
EintTSec = EintSec 'Set Tenths
strPos = InStr(1, (EintSec), ".") 'Find decimal point
EintSec = Left(EintSec, (strPos - 1)) 'Set seconds value
txtSec = Str(EintSec) 'String Seconds +++++++++++++++++++++++
txtSec = LTrim(txtSec)
strLEN = Len(txtSec)
If strLEN = 1 Then
txtSec = (":0" + txtSec)
Else
txtSec = (":" + txtSec)
End If
End If
'+++++++++++++++++++Tenths of seconds
If EintTSec > 0 Then
EintTSec = EintTSec - EintSec
strPos = InStr(1, (EintTSec), ".")
txtTSec = LTrim(Str((Right(txtTSec, 2))))
End If