View Single Post
  #2  
Old June 3rd, 2010, 09:24 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Storing time as integers


You can do it with some math.

If you store the duration in seconds. And for example the duration is 7356

There is no field type in Access that stores duration.

One way to handle duration is to use a numeric field and store the number of
units of time that is the smallest that you are interested in recording. In
your case you might be storing the seconds. Then you can manipulate the
seconds to get duration in terms of hours, minutes and seconds. Assuming that
your field is named "Duration"

Seconds: Duration Mod 60
Minutes: (Duration\60) Mod 60
Hours: Duration\3600

To display that as hours minutes and seconds

Duration\3600 & ":" & Format((Duration\60) Mod 60,"00") & Format(Duration Mod
60,"00")


HTH


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

SSi308 wrote:
I have a call database that includes a field for length of call. I have
created a query that includes employee, date, and length of call.

I need to calculate the average call length per employee and as a whole. I
found one post that suggested the following:
"To store time intervals you should store them as integers that represent
the number of hours or minutes or seconds, etc.. and then you can perform
whatever math you like. The results can then be converted to the hh:nn:ss
format for display. "

How is this accomplished?

Lori