summing time field

M

Mark

Hi all,

On a form, I have a field where the user can enter a time
amount in hours and minutes (ex. 01:20). As in:

Field Name = Time
Input Mask = 00:00;0;_

On a report, I would like to count/sum the time. So, if
there are say three records with the times of 01:00,
00:20, and 00:50 I would like to calculate the total time
of 02:10.

I had previous just used minutes in calculating the time,
as in: =Sum([Time]) & " minutes"

But am thinking that it might be more user friendly to use
HH:MM in the time field on the form and calculate this out
in the report. Any suggestions on going about this would
be greatly appreciated. Thanks!!!
 
J

Jim/Chris

This is a post from Wayne Morgan
It is probably easiest to store that data as the smallest
unit available,
minutes or seconds, then format it when you need it.

If in minutes and to display as hours and minutes:

=[TimeField]\60 & "h" & [TimeField] Mod 60 & "m"

The back slash "\" is intentional, it is "integer division".

If you store the data in seconds:

=[TimeField]\3600 & "h" & ([TimeField]\60) Mod 60 & "m" &
[TimeField] Mod
3600 Mod 60 & "s"

Jim
 
S

sun

hahahahhahahha
reply!
Jim/Chris said:
This is a post from Wayne Morgan
It is probably easiest to store that data as the smallest
unit available,
minutes or seconds, then format it when you need it.

If in minutes and to display as hours and minutes:

=[TimeField]\60 & "h" & [TimeField] Mod 60 & "m"

The back slash "\" is intentional, it is "integer division".

If you store the data in seconds:

=[TimeField]\3600 & "h" & ([TimeField]\60) Mod 60 & "m" &
[TimeField] Mod
3600 Mod 60 & "s"

Jim
-----Original Message-----
Hi all,

On a form, I have a field where the user can enter a time
amount in hours and minutes (ex. 01:20). As in:

Field Name = Time
Input Mask = 00:00;0;_

On a report, I would like to count/sum the time. So, if
there are say three records with the times of 01:00,
00:20, and 00:50 I would like to calculate the total time
of 02:10.

I had previous just used minutes in calculating the time,
as in: =Sum([Time]) & " minutes"

But am thinking that it might be more user friendly to use
HH:MM in the time field on the form and calculate this out
in the report. Any suggestions on going about this would
be greatly appreciated. Thanks!!!

.
 

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