Results 1 to 2 of 2

Thread: [RESOLVED] calculate time (24-hour)

  1. #1

    Thread Starter
    Lively Member chxxangie's Avatar
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    79

    Resolved [RESOLVED] calculate time (24-hour)

    for example:
    time-A: 1749
    time-B: 1555
    how to count: how many minutes between time-A and time-B?
    or is there VB library can do for this?

  2. #2
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: calculate time (24-hour)

    Code:
    Private Sub Command1_Click()
    Label1.Caption = DateDiff24Hr("1749", "1555")
    End Sub
    
    Function DateDiff24Hr(Time1 As String, Time2 As String)
        Time1 = Left(Time1, 2) & ":" & Right(Time1, 2)
        Time2 = Left(Time2, 2) & ":" & Right(Time2, 2)
        
        DateDiff24Hr = DateDiff("n", Time2, Time1)
    End Function
    Assuming that the 24hour times will be 4 digits.

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