Elapsed Time

B

blueman

Can I use something like DateDiff [TimeIn], [TimeOut]) to
calculate elapsed time?

I'm not interested in the date. I have the fields set to medioum time,
i.e 11:30 AM

I don't know vba and really don't have time to learn if it's
avoidable. Im doing this for my business and am not a programmer.

Thanks


Mike
 
J

John Spencer

DateDiff("n",[TimeIn],[TimeOut])
will return the number of minutes between to times. If you want seconds
then use "s" instead of "n".

If your times include a date compoment then you will need to strip off
the date

DateDiff("n",TimeValue([TimeIN]),TimeValue([TimeOut]))

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
K

Klatuu

John has given you the correct answer, but one caveat. If, by chance,
[TimeIn] happened to be a later time on the previous day, you will get a
negative number returned. If it was an earlier time on a previous day, the
returned value will be misleading.
For example
[TimeIn] = 6/11/2008 10:15:00 PM
[TimeOut] = 6/12/2008 10:01:01 AM

=DateDiff("n", TimeValue([TimeIn], [TimeOUt]) returns -734
=DateDiff("n", [TimeIn], [TimeOut]) returns 706

706 is the correct answer regardless of the date portion of the value


Leaving out the TimeValue will be accurate.


=DateDiff("n", [TimeIn], [TimeOut])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top