Results 1 to 2 of 2

Thread: REQ help: Calculating elapsed time from date/time began from Date/time ended

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    1

    Post

    I have four controls, two are Date-Time Pickers set for Date and the last two are text boxes set for Time with the "...If Not IsTime()..." validation.

    It is the standard Date and Time problem began, Date and Time problem ended.

    I am trying to calculate the elapsed time between these in "" DAYS "" HOURS ""MINUTES.

    I coded this in Lotus Notes yet exporting my knowledge to VB is problematic.

    Has anyone a code snippet of how to do this in VB - yes, I know about the DateDiff.

    Many, MANY thanks!

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

    Post

    well you could divide the date in sections like
    Code:
    hours = left$(time,2)
    minutes = mid$(time,3,1)
    seconds = right$(time,2)
    then just subtract that from the beginning time by doing the same.you'ld probably have to use 24 hour time though or you could possibly use 12 hour time with am and pm just use:
    Code:
    if right$(time$,2) = "PM" then
    hourstot = left$(time$,2)
    hours = val(hourstot) + 12
    else
    hours = val(left$(time$,2))
    end if
    that should work i wrote it without testing so it should work! good luck!

    ------------------
    DiGiTaIErRoR

    [This message has been edited by DiGiTaIErRoR (edited 11-20-1999).]

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