Time Calculations

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I need some help here please.....

I have a table with different times in i.e

10:15:00
11:20:00
11:00:00

What i need to know is if there is a simple way of adding these fields so i
get the following result-

32:35:00

Cheers
 
Internally, Access stores date/time fields as fractional numbers, where the
whole number represents the day and the fraction the time (part of the day).
That means that if you sum time values and it wraps past 24 hours, Access
present the result as just the time portion on another date.

It is easier to store durations in a Number field (e.g. number of minutes),
sum them, and then use integer division and Mod to display the results.

You could operate on the total to convert to minutes and then get rework the
display:
DateDiff("n", #0:00:00#, [SumOfTime])

For an explanation of how to format the minutes as hours and minutes, see:
Calculating elapsed time
at:
http://members.iinet.net.au/~allenbrowne/casu-13.html
 
I read you post on "Calculating Elapsed Time". I do have a question though
on formatting.
Lets say that [Minutes]=113. With the formula =[Minutes] \ 60 & Format
([Minutes] Mod 60, "\:00") you would get 1:53
My questions is: is there a way that you could have it display 1 min 53 sec?

Allen Browne said:
Internally, Access stores date/time fields as fractional numbers, where the
whole number represents the day and the fraction the time (part of the day).
That means that if you sum time values and it wraps past 24 hours, Access
present the result as just the time portion on another date.

It is easier to store durations in a Number field (e.g. number of minutes),
sum them, and then use integer division and Mod to display the results.

You could operate on the total to convert to minutes and then get rework the
display:
DateDiff("n", #0:00:00#, [SumOfTime])

For an explanation of how to format the minutes as hours and minutes, see:
Calculating elapsed time
at:
http://members.iinet.net.au/~allenbrowne/casu-13.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Songoku said:
Hi,

I need some help here please.....

I have a table with different times in i.e

10:15:00
11:20:00
11:00:00

What i need to know is if there is a simple way of adding these fields so
i
get the following result-

32:35:00

Cheers
 
=[Minutes] \ 60 & " min " & Format ([Minutes] Mod 60, "00") & " sec"

or

=Format([Minutes] \ 60, "0\ \m\i\n\ ") & Format ([Minutes] Mod 60, "00\
\s\e\c")

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Steve Voorhees said:
I read you post on "Calculating Elapsed Time". I do have a question though
on formatting.
Lets say that [Minutes]=113. With the formula =[Minutes] \ 60 & Format
([Minutes] Mod 60, "\:00") you would get 1:53
My questions is: is there a way that you could have it display 1 min 53 sec?

Allen Browne said:
Internally, Access stores date/time fields as fractional numbers, where the
whole number represents the day and the fraction the time (part of the day).
That means that if you sum time values and it wraps past 24 hours, Access
present the result as just the time portion on another date.

It is easier to store durations in a Number field (e.g. number of minutes),
sum them, and then use integer division and Mod to display the results.

You could operate on the total to convert to minutes and then get rework the
display:
DateDiff("n", #0:00:00#, [SumOfTime])

For an explanation of how to format the minutes as hours and minutes, see:
Calculating elapsed time
at:
http://members.iinet.net.au/~allenbrowne/casu-13.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Songoku said:
Hi,

I need some help here please.....

I have a table with different times in i.e

10:15:00
11:20:00
11:00:00

What i need to know is if there is a simple way of adding these fields so
i
get the following result-

32:35:00

Cheers
 
Back
Top