Results 1 to 6 of 6

Thread: Add 30 minutes to time? (hh:mm)

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    14

    Post

    I can add day's to months using cvdate, but it does not seem to work with time formatted hh:mm. I wish to add 30 minutes to time stored in a variable. How can i do thsi please?

    Dan

  2. #2
    Junior Member
    Join Date
    Nov 1999
    Location
    Sydney, NSW, Australia
    Posts
    16

    Post

    As 1 day is equal to to value 1, to add 30 minutes I would try adding, 1/48.


  3. #3
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    This works (at least on my machine):

    Private Sub Command1_Click()
    Text1.Text = Time + (1 / 24) / 2
    End Sub



    ------------------
    Tom Young, 14 Year Old
    [email protected]
    ICQ: 15743470 Add Me ICQ Me
    AIM: TomY10
    PERL, JavaScript and VB Programmer

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

    Post

    Why do you want to count the time by yourself if you already have a great VB function called DateAdd.

    Usage: DateAdd Iterval, Number, Date/Time

    Example:

    Dim dtTime As Date

    dtTime = Time
    MsgBox DateAdd("n", 30, dtTime)


    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819



    [This message has been edited by Serge (edited 11-28-1999).]

  5. #5
    Guest

    Post

    MyDate = DateAdd("n", 30, Now)
    MyTime = Format(MyDate, "hh:mm")


    look for DateAdd in the help files or the MSDN CD

    ------------------

    Wossname,
    Email me: [email protected]

  6. #6
    Guest

    Post

    dang! beat me to it serge!

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