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

Accumulate Time Values

Status
Not open for further replies.

harding1031

Programmer
Oct 21, 2004
65
US
CR 9.0
I currently have a report that displays start time, stop time, and time processing, which is the difference between the start and stop time. I am trying to get a total time process, but everything I try I come up short.
start stop time processing
11:00 11:30 :30
12:00 13:00 1:00

total: 1:30
I can not seem to sum up the time processing field(it is defined as time field). TIA.
 
Create a formula:

datediff("s",datetime(date(0,0,0),{table.starttime}),datetime(date(0,0,0),{table.stoptime}))

Using SynapseVampire's FAQ767-3543, plug the seconds value into the following formula as shown:

numberVar dur := datediff("s",datetime(date(0,0,0),{table.starttime}),datetime(date(0,0,0),{table.stoptime}));
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;

hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);

hhmmss := totext(hrs, "0") + ":" + totext(min, "00") + ":" + totext(sec, "00");

hhmmss

If you have a date field, I would use that in the formula instead of date(0,0,0)--to allow for time diffs that cross days.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top