|
-
Nov 5th, 2002, 07:43 PM
#1
Thread Starter
Hyperactive Member
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.
-
Nov 5th, 2002, 08:21 PM
#2
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:
ElapsedTime = DateDiff("s", CVDate(starttime), CVDate(endtime))
This snippet would calculate the elapsed time (in seconds) between 2 date/time values.
Cheers
-
Nov 5th, 2002, 08:27 PM
#3
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|