434,998 Members | 2,815 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

# Elasped Time

 P: n/a I'm looking for some help with a error in the code below. When 119.45 seconds are entered the code returns 01:59.45, but when you enter 119.51 the code returns 02:59.51. But, if I enter 120.00 the code returns 02:00.00. Can anyone help figure out what is happening? Public Function Elasped_Time(TimeElapsed As Double) As String Dim Tenths As Double Dim Seconds As Double Dim Minutes As Double Dim Hours As Double Dim A As String 'Find The Seconds Seconds = Int(TimeElapsed) Mod 60 'Find The Minutes Tenths = TimeElapsed - Int(TimeElapsed) Minutes = (TimeElapsed \ 60) Mod 60 'Find The Hours Hours = (TimeElapsed \ 3600) 'Format The Time If Hours >= 0 Then A = Format(Hours, "0") & ":" End If A = Format(Hours, "00") & ":" A = A & Format(Minutes, "00") & ":" A = A & Format(Seconds, "00") A = A & Format(Tenths, ".00") Elasped_Time = A End Function Nov 19 '06 #1