Results 1 to 4 of 4

Thread: Decrementing a Time value?

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    7
    How can I subtract 00:00:01 from , say 00:10:45 ?

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    Look in the help at DateAdd command; I can't test it right now but it should be something like;

    NewTime = DateAdd("s",-1,OldTime)

    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    7

    Smile

    Thanks for the help!

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Lightbulb

    You also can substruct dates like you substruct numbers:
    Code:
    Private Sub Command1_Click()
        Dim datFirst As Date
        Dim datSecond As Date
    
        datFirst = #12:10:45 AM#
        datSecond = #12:00:01 AM#
    
        datFirst = datFirst - datSecond
        MsgBox datFirst
    End Sub

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