Time Difference between two events

  • Thread starter Thread starter Joseph
  • Start date Start date
J

Joseph

Hi Guys and Gals,

I have a start button. This should start a timer. The stop button(whe
clicked) should calculate the time difference between the start an
stop events. How would I do this? I am basically monitoring a user'
activities to see exactly how long it takes them to carry out a certai
task.

Cheers people
Josep
 
when u click start, capture the current time and when you click sto
again capture the current time. find the difference between the two
Roughly speaking

startTime = now()
endTime = now()

totalTimeDays = endTime - startTime (this will give you time in days)

If you want in seconds, mutiply totalTimeDays with nos of seconds

totalTimeSecs = totalTimeDays * (24*60*60)

Manges
 
Hi Mangesh,

This is more or less what I'm looking for, but I don't want the dat
part, I know you can use Format to to get what you want, but Im a bi
unsure as to the syntax? I need the difference to be displayed in HH:M
format?

Cheer
 
so its all the more simple. you jsut have to find the diff i.e
totalTimeDays and then format the cell to display the result in HH:MM

Manges
 
I see what you're saying, but this is going to be done in a form an
then saved to a database, so the formatting has to be done in code. Th
other problem i'm having is the the startTime and endTime variables ar
storing the same value from the Now() function. Here is the code:

Dim startTime, endTime
startTime = Now()
endTime = Now()
MsgBox (startTime)
MsgBox (endTime)
MsgBox (Format(startTime - endTime, "HH:MM:SS")
 
Its ok Mangesh, I finally figured out that it was the position of the
variables in the code that was throwing it. Thanks for your help.
 
yes ofcourse. You need to place the start so that the line is executed
right after you click the start button. And similar is the end button

mangesh
 
Back
Top