PDA

Click to See Complete Forum and Search --> : Making a milliesec in vb6


snortop
Dec 22nd, 2011, 05:10 AM
Can you improve my code.

It after you subtract 2 dates from each other.
And then you want to find out have much time the is between it.
Sometime you want to find that out in millisec.
It easly done in 2010 version.
Whit at "ts.TotalMilliseconds"

Public Function MyTimeReturnMillisec(TimeCheck As Date) As String
Dim Min As Integer

Dim timetekst As String
timetekst = "0"

If Hour(TimeCheck) > 1 Then
timetekst=val(timetekst) + (hour(TimeCheck) * 60 * 60 * 100)
End If


If Minute(TimeCheck) > 0 Then
timetekst = Val(timetekst) + ((Minute(TimeCheck) * 60) * 100)
End If

If Second(TimeCheck) > 0 Then
timetekst = Val(timetekst) + (Second(TimeCheck) * 100)
End If

Min = Format(TimeShow, "ss") & Right(Format(Timer, "#0.00"), 2)

timetekst = Val(timetekst) + Min

MyTimeReturnMillisec = timetekst
End Function