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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time formulas rounding up?

Status
Not open for further replies.

Jacque

Technical User
Nov 9, 2001
301
US
Hi,
I'm doing some reports which involve a lot of time manipulations and am finding that some of my time summations are rounding up. I have to do summing, totals, averages and grandtotals on time fields. I'm OK on averages but the rounding up on totals and grandtotals looks funky. This is how I'm been handling time fields (definitely not my speciality although I've been tasked with it):

First I create a formula which contains the following:
@duration in secs
mission.duration - time(0,0,0)

Then in a running total I do the summary function.

#Sum Act duration
Field to summarize: @duration in secs
type of summary: sum
Evaluate on chg of field: Mission.mission_id
Reset on chg of group: Group#2 current date

Then I plop the running total in a formula

numberVar sumofduration := {#Sum Act duration};

numberVar vhr := int(sumofduration/3600);
numberVar vrem := remainder(sumofduration,3600);

numberVar vmin := int(vrem/60);
vrem := remainder(vrem,60);

numberVar vsec := int(vrem);

stringVar colon := ":";
stringVar vshr := IIF(vhr<10,&quot;0&quot;+ToText(vhr,0),ToText(vhr,0));
stringVar vsmin := IIF(vmin<10,&quot;0&quot;+ToText(vmin,0),ToText(vmin,0));
stringVar vssec := IIF(vsec<10,&quot;0&quot;+ToText(vsec,0),ToText(vsec,0));
stringVar timestring := vshr+colon+vsmin+colon+vssec;

What am I doing wrong? [bugeyed]
Thanks for all your help.
Jacque
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top