Public Function TimerStuff(TimeElapsed As Double) As String
Dim Seconds As Double
Dim Minutes As Double
Dim Hours As Double
Dim A As String
'Find The Seconds
Seconds = TimeElapsed Mod 60
'Find The Minutes
Minutes = (TimeElapsed \ 60) Mod 60
'Find The Hours
Hours = (TimeElapsed \ 3600)
'Format The Time
If Hours >= 0 Then
A = Format(Hours, "00") & ":"
End If
A = Format(Hours, "00") & ":"
A = A & Format(Minutes, "00") & ":"
A = A & Format(Seconds, "00.00")
TimerStuff = A
End Function
Here's how I might try it (air code):
'Begin Module Code-------
Type SwimTime
Hours As Integer
Minutes As Integer
Seconds As Double
End Type
Public Function FormatSwimTime(theSwimTime As SwimTime) As String
FormatSwimTime = Format(theSwimTime.Hours, "00") & ":" &
Format(theSwimTime.Minutes, "00") & ":" & Format(theSwimTime.Seconds,
"00.00")
End Function
'End Module Code------------
Then in your function:
Dim ASwimTime As SwimTime
...
Seconds = TimeElapsed - 60 * Int(TimeElasped / 60)
...
ASwimTime.Hours = Hours
ASwimTime.Minutes = Minutes
ASwimTime.Seconds = Seconds
TimerStuff = FormatSwimTime(ASwimTime)
End Function
Actually, the 'Seconds = TimeElapsed - 60 * Int(TimeElasped / 60)' part
is probably all you really need to make your code work.
James A. Fortune
CDMAP...@FortuneJames.com