Calculating time between dates

  • Thread starter Thread starter Carlos
  • Start date Start date
C

Carlos

Hello,

I want to calculate time but only want it calculated
between 8 - 5pm.

So if a record is dated 09/23/03 4:45pm and the end date
of that call is 09/24/03 8:15am I want it to only show
that it took 1/2 hour to complete instead of counting all
the hours of the day because these are the only times that
people will work 8-5.

Thanks in advance
 
How about the calculation:
Hours: DateDiff("h",[dtBeg],[dtEnd])-DateDiff("d",[dtBeg],[dtEnd])*15
Of course this wouldn't account for lunches, weekends, holidays..
 
Hello,

I want to calculate time but only want it calculated
between 8 - 5pm.

Skipping weekends and holidays as well I presume?
So if a record is dated 09/23/03 4:45pm and the end date
of that call is 09/24/03 8:15am I want it to only show
that it took 1/2 hour to complete instead of counting all
the hours of the day because these are the only times that
people will work 8-5.

You'll probably need some VBA code to do this if the answer to the
question above is yes. But as literally phrased, you could get this
with an expression like:

DateDiff("n", [StartTime], [EndTime]) - IIF(DateValue([EndTime]) >
DateValue([StartTime]), 900, 0)

This subtracts 900 minutes (the overnight time) from the directly
calculated minutes elapsed.
 
Whoops, the one below only gives whole hours, for fractions, try:
Hours: ([dtEnd]-[dtBeg])*24-DateDiff("d",[dtBeg],[dtEnd])*15

John Verhagen said:
How about the calculation:
Hours: DateDiff("h",[dtBeg],[dtEnd])-DateDiff("d",[dtBeg],[dtEnd])*15
Of course this wouldn't account for lunches, weekends, holidays..

Carlos said:
Hello,

I want to calculate time but only want it calculated
between 8 - 5pm.

So if a record is dated 09/23/03 4:45pm and the end date
of that call is 09/24/03 8:15am I want it to only show
that it took 1/2 hour to complete instead of counting all
the hours of the day because these are the only times that
people will work 8-5.

Thanks in advance
 
Back
Top