Results 1 to 3 of 3

Thread: Date and Time comparison [RESOLVED]

  1. #1

    Thread Starter
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349

    Date and Time comparison [RESOLVED]

    Guys,
    Heres what i want to do. I have a logging program that records the date and time a process was started and also logs the date and time of when it completed. What i want to do is compare these values to get an elapsed time for the process. Because the logging program writes the data to a text file, i have this data in string format. Does anyone have any code that can do this comparison.
    Last edited by Blinky Bill; Nov 5th, 2002 at 08:27 PM.
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

  2. #2
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918
    Assuming your date/time values are written to the log file like this 6/11/2002 12:11:04 you could do your comparisons along these lines:
    1. Read the start date/time from file
    2. Read the end date/time from file
    3. Convert these strings to dates using CVDate()
    4. Calculate the interval using DateDiff()
    VB Code:
    1. ElapsedTime = DateDiff("s", CVDate(starttime), CVDate(endtime))
    This snippet would calculate the elapsed time (in seconds) between 2 date/time values.

    Cheers

  3. #3

    Thread Starter
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    Thanx pnish, it works gr8!
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

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