Results 1 to 3 of 3

Thread: [RESOLVED] Adding time values???

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Resolved [RESOLVED] Adding time values???

    I have a database field that is defined as a "text" field but is stored as a time field "00:00:29", etc.

    What I need to do is be able to accumulate this field value and I'm not sure what functions I need to use to do that.

    For ex:

    00:00:49
    00:12:33
    00:04:19
    01:02:29

    I need to be able to accumulate these values and give me the total time.

    Thanks,
    Blake

  2. #2
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    Jar, Norway
    Posts
    372

    Re: Adding time values???

    VB Code:
    1. Dim sumTime as Single
    2.   Dim endTime As Date
    3.   Do Until rs.EOF
    4.     sumTime = sumTime + CDate(rs!timeField)
    5.     rs.moveNext
    6.     ' sumTime is like 0.42345 format keep that without converting back to ##:##:## format
    7.     ' OPS! Problem if sumTime > 24 hours! and converted back above format
    8.   Loop
    9.   endTime = CDate(sumTime)

    Strange, but it works!
    Last edited by Ember; Jan 2nd, 2007 at 05:55 PM.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Re: Adding time values???

    Thanks Ember, but I figured it out!
    Blake

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