PDA

Click to See Complete Forum and Search --> : Makeing a "Time that Passes from point 2 point" program with the 00:00:00 format.


Jan 15th, 2000, 04:10 PM
Hello i am trying to make a little progi that just gives me the time passes from one time to anouter This is how i am doing this :
Makeing one time with the old velue [OldV = timer] after about 15 secondes i make the new velue [Newv = timer ]
total = abs(newv -oldv)
TP = (Format(CStr(Int((Total / 60) / 60) & Int(Total / 60) & Tot Mod 60), "00:00:00"))
print tp
'this will print the time passed in the ##:##:## format and to reconvert it i use :
TSec = Int(((Hour(TP)* 60) * 60) + Int((Minute(TP)* 60)) + Int(Second(TP))
--------------------------------------------
But there is something wrong with the code becuse i am have truble with it Please help if you can , thank you ...

DiGiTaIErRoR
Jan 15th, 2000, 04:39 PM
This tells you the current duration of time from the program starting to the existing time with a little tweaking you can make it do what you want:

Private Sub Form_Load()
Label1.Caption = Time$
End Sub


Private Sub Timer1_Timer()
Dim Secs As Integer
Dim Mins As Integer
Dim Hours As Integer
Secs = Right(Time$, 2) - Right(Label1.Caption, 2)
If Secs < 0 Then Secs = 60 - Right(Label1.Caption, 2) + Right(Time$, 2)
If Right(Time$, 2) >= Right(Label1.Caption, 2) Then Mins = Val(Mid$(Time$, 4, 2)) - Val(Mid$(Label1.Caption, 4, 2))
If Mins < 0 Then Mins = 60 - Val(Mid$(Label1.Caption, 4, 2)) + Val(Mid$(Time$, 4, 2))
Hours = Left(Time$, 2) - Left(Label1.Caption, 2)
Text1.Text = Hours & ":" & Mins & ":" & Secs
End Sub

I made this a while ago all you'll need to change it time$ to the second time and you may need to check if the length of the hours:minutes:second is 1 character or 2 to change it to fit your format

------------------
DiGiTaIErRoR