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!

Formatted "elapsed time" string - no days, increase hrs 1

Status
Not open for further replies.

JULY1

MIS
May 13, 2002
16
US
I found a formula to use that is helpful from Ken Hamady's web site. However I would like to edit it by doing away with the "days" and carry over that time to allow the "hours" portion to increase.

Here is the formula I'm using:

WhilePrintingRecords;
NumberVar TotalSec := Sum ({CallDetailRecord.duration});
NumberVar Days := Truncate (TotalSec / 86400);
NumberVar Hours := Truncate (Remainder ( TotalSec,86400) / 3600);
NumberVar Minutes := Truncate (Remainder ( TotalSec,3600) / 60);
NumberVar Seconds := Remainder ( TotalSec , 60);

Totext ( Days, '00', 0,'') + ':'+
Totext ( Hours, '00', 0,'') + ':'+
Totext ( Minutes,'00', 0,'') + ':'+
Totext ( Seconds,'00', 0,'')

I'm a novice at this so please try to keep it simple.

Thanks,
Linda

 
Try this:

WhilePrintingRecords;
NumberVar TotalSec := Sum ({CallDetailRecord.duration});
NumberVar Days := Truncate (TotalSec / 86400);
NumberVar Hours := Days*24 +
Truncate (Remainder ( TotalSec,86400) / 3600);
NumberVar Minutes := Truncate (Remainder ( TotalSec,3600) / 60);
NumberVar Seconds := Remainder ( TotalSec , 60);


Totext ( Hours, '00', 0,'') + ':'+
Totext ( Minutes,'00', 0,'') + ':'+
Totext ( Seconds,'00', 0,'')
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top