Functions that calculate two time differences
'*********************************
'||FunctionTimeDiff(sBegin,sEnd)
'||This function calculates the difference between two times and can be used directly without changing it.
'||Author: machinecat2001/10/26
'*********************************
'*********************************
'Note: First, you need to determine the size between sBegin and sEnd entered by the user
'The time difference between the two can be obtained through the DataDiff function, without complicated time conversion
'*********************************
FunctionTimeDiff(sBegin,sEnd)
DimiHourB, iMinuteB, iSecondB, iMiniSecondB
DimiHourE, iMinuteE, iSecondE, iMiniSecondE
DimdTimeB,dTimeE,dTimeDiff
DimiHour, 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*60+iSecondB+iMiniSecondB/1000
dTimeE=iHourE*3600+iMinuteE*60+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"
EndFunction