Calculate date/time

  • Thread starter Thread starter Julie
  • Start date Start date
J

Julie

Hi - I am keeping track of the time a doctor spends with
patients on his shift. I am having a problem when a
doctor is with a patient, say from Thursday night at 11:00
pm, and is finished at 1:30 am. I have a "total time"
field that calculates the total time he/she spent with
that patient. When the time goes from one day to the
next, the calculation is off. So if the Dr. starts at
2:00 pm and ends at 4:00 pm, it shows the correct
calculation of 2 hours. If he starts at 11:00 pm and ends
at 1:00 am, it shows 21 hours. Any ideas? I use =[stop]-
[start] as my calculation.

thanks!
 
Store both the date and time in the start and stop fields (date/time
format -- you can use the Now() function to capture the date and time at the
moment when you call the function), then use the DateDiff function to
calculate the time difference:

MinutesSpentWIthPatient = DateDiff("n", [start], [stop])

You then can convert the minutes to hours, days, etc. by math calculation.
 
Back
Top