Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Total number of minutes and seconds

Status
Not open for further replies.

ad2

Technical User
Dec 31, 2002
186
US
Hi,

I was given a db that has a field for minutes and a field for seconds. Both are field types are number.

For each customer I need to calculate the total number of minutes and seconds. What would be the best way to do this?

Convert the Minutes to seconds by dividing by 60 and then add that and the Seconds field together and divide by 60?

Is there an easier way?
 
I would multiply the minutes by 60 and add to the seconds. Then sum the results. If you need to see your results in minutes and seconds, you could try
Minutes = Sum([Minutes] * 60 + [Seconds])\60
Seconds = Sum([Minutes] * 60 + [Seconds]) Mod 60

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
This is working well. I'm grouping by customer and the minuets for the month are calculatint to the fraction in the new derived field, such as 41656.8666666667.

In the table the field is a long integer, no fractions. Is there a way to get this to drop the decimal in the query and just be, 41656 ?
 
ad2,
[tt]Minutes = Sum([Minutes] * 60 + [Seconds])[red]\[/red]60[/tt]
If your using interger division (\) you should not get a decimal. Are you using regular division (/)?

CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT+08:00) Singapore
 
Yes CMP, I was using / Thanks for that tip. And thanks to Skip for the info about interger function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top