ChewDoggie
Programmer
g'morning all!
I need some assistance with an algorithm (I'm embarrassed to say). I have a time in a db (TimeSave), recorded in milliseconds, that I need to convert to Hours & Minutes & Seconds & Milliseconds on a VB Form. My code currently looks like this:
I seems to work kind of OK, but the minutes always resolves to 1 more minute than I need. Any help would be appreciated.
ciao for niao!
AMACycle
American Motorcyclist Association
I need some assistance with an algorithm (I'm embarrassed to say). I have a time in a db (TimeSave), recorded in milliseconds, that I need to convert to Hours & Minutes & Seconds & Milliseconds on a VB Form. My code currently looks like this:
Code:
If TimeSave <> 0 Then
secs = TimeSave / 1000
msecs = TimeSave Mod 1000
If secs > 60 Then
mins = secs / 60
secs = secs Mod 60
If mins > 60 Then
hrs = mins / 60
mins = mins Mod 60
End If
End If
End If
If hrs = 0 Then
txtHours.Text = ""
Else
txtHours.Text = hrs
End If
If mins = 0 Then
txtMinutes.Text = ""
Else
txtMinutes.Text = mins
End If
If secs = 0 Then
txtSeconds.Text = ""
Else
txtSeconds.Text = secs
End If
If msecs = 0 Then
txtMSeconds.Text = ""
Else
txtMSeconds.Text = msecs
End If
I seems to work kind of OK, but the minutes always resolves to 1 more minute than I need. Any help would be appreciated.
ciao for niao!
AMACycle
American Motorcyclist Association