(Wait )Time Calculations

V

Van W

I'm trying to do simple calculations with the data type
Date/Time and I'm running into all types of problems. I
hoped this would be a simple database to calculate wait
times for patients. A start time and end time are entered
as a record. The data types were Date/Time with a format
of Short Time. A calculated field (Wait Time) finds the
difference by subtrating start time from end time. How do
a find Sums or Averages of wait time? Do these functions
only work with numeric values. Is there a conversion
function I can use. I can't find any information of doing
calculations with a time value. I tried the Avg() and Sum
() functions in the report but only received an error. Are
there no functions that do calculations of time.Any help
would be appreciated.
Thanks, Van
 
K

Ken Snell

In ACCESS, dates and times are stored as a decimal number. The integer part
is the number of days since December 31, 1899. The decimal part is the
fraction of a day represented by the time (based on 24-hour day).

Thus, for example, 5 AM on January 1, 2003 is this number:
37622.2083333333

The way to calculate time differences is to use the DateDiff function to get
the time difference; it's best to do this in minutes and then manipulate the
result into the desired units. For example, if you want the time difference
in minutes between 5 AM and 11 AM on January 1, 2003, you'd use this
expression:
DateDiff("n", #1/1/2003 5 AM#, #1/1/2003 11 AM#)

You then can convert the number of minutes to hours, days, etc.
 

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