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

Total

Status
Not open for further replies.

jpillonel

Programmer
Dec 17, 2003
61
CH
Hi,

I have a field on my database time_spent_sum.

This field is an elapsed time in seconds.

Ho can I create a total for this field ?

I used this formula to convert to hh:mm:ss :

numberVar dur := datediff("s",{Orders.Order Date}, currentdate); //get the seconds between 2 dates
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
//



Thanks for your help !
 
Why converting to date? Sum it up in seconds and conver the total to hours, min, seconds... the way you are doing it.
 
Sorry I was wrong, I use this formula to convert, but how can I add a SUM ???

numbervar dur :={xxxxx;
numbervar hrs;
numbervar min;
numbervar sec;
numbervar 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);


Thanks !!!!
 
Not sure I understand the question. Summary formulae can be used in other formulae. So if dur is total in seconds, should be OK. Or I missing something?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top