PDA

View Full Version : Subtracting 2 times in Visual Basic 6?



Memo
09-06-2004, 12:09 PM
So I haven't done VB programming in probably 6-7 years. I'm trying to create a simple program to calculate the amount of hours an employee worked for the week. I have input fields for each days clocked in and clocked out. I want to subtract clocked in from clocked out to get the total number of hours.

The time will be input into a serial of text boxes named like day1_clockedin and day1_clockedout. Time will be input like 8:00am and 5:00pm (There will be an option button to the side wher they can click am or pm, they won't actually put in the text box). I will convert the time to 24 hour time before subtracting if needed. But how do I actually get the difference between times? Seems like something easy to do. Do I have to parse the hours/minutes or is there a function?

Thanks in advance,

Memo :wavey2:

seqiro
09-07-2004, 07:53 AM
DateDiff (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctdatediff.asp) Function