Results 1 to 2 of 2

Thread: Makeing a "Time that Passes from point 2 point" program with the 00:00:00 format.

  1. #1
    Guest

    Post

    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 ...

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    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:
    Code:
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width