Function
'******************************
'|| Function Timediff (Sbegin, SEnd)
'|| This function calculates the difference of two times and can be used without changing the
'|| Author: Machinecat 2001/10/26
'******************************
'******************************
' Note: First you need to determine the size of the user input between Sbegin and send
' You can get a time difference between the two by using the Datadiff function, and you don't need to do a complicated conversion.
'******************************
Function Timediff (Sbegin, SEnd)
Dim ihourb, Iminuteb, Isecondb, iminisecondb
Dim ihoure, Iminutee, Iseconde, Iminiseconde
Dim Dtimeb, Dtimee, Dtimediff
Dim Ihour, Iminute, Isecond, Iminisecond
Ihourb = CLng (Left (Sbegin, 2))
Iminuteb = CLng (Mid (Sbegin, 4, 2))
Isecondb = CLng (Mid (Sbegin, 7, 2))
Iminisecondb = CLng (Mid (Sbegin, 10, 4))
Ihoure = CLng (Left (sEnd, 2))
Iminutee = CLng (Mid (SEnd, 4, 2))
Iseconde = CLng (Mid (SEnd, 7, 2))
Iminiseconde = CLng (Mid (SEnd, 10, 4))
DTIMEB = ihourb * 3600 + iminuteb + isecondb + iminisecondb/1000
Dtimee = ihoure * 3600 + iminutee + Iseconde + iminiseconde/1000
Dtimediff = Dtimee-dtimeb
Ihour = Int (dtimediff/3600)
Dtimediff = Dtimediff-ihour * 3600
Iminute = Int (DTIMEDIFF/60)
Dtimediff = Dtimediff-iminute * 60
Isecond = Int (Dtimediff)
Dtimediff = Dtimediff-int (Dtimediff)
Iminisecond = Dtimediff
Timediff = ihour & "Hours" & iminute & "Minutes" & Isecond & FormatNumber (Iminisecond, 3) & "seconds"
End Function