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

Need to convert a number to a time

Status
Not open for further replies.

MisterrMac

Technical User
Jul 19, 2002
20
US
I'm new to using Crystal but I thought this wouldn't be such a difficult task:
I am pulling open duration information from Help Desk Tickets to calculate how much time each person is spending on them over a given range of days. Each instance is in seconds and a grand total, also seconds, is displayed at the end of each user listing. Now I want to convert that into an HH:MM:SS format and show it on the report. How would I formulate that?

Any Help is appreciated?!
 
no problem

one hour has 60 * 60 = 3600 secs

@convertToTime

WhilePrintingRecords;
numberVar testHours;
numberVar testMins;
numberVar testSecs;

testHours := truncate({Table.seconds)/3600)
testMins := truncate((({Table.seconds)/3600) - testHours)*60)
testSecs := truncate((((({Table.seconds)/3600) - testHours)*60) - testMins)*60)

totext(Time(testHours,testMins,testSecs),"hh:mm:ss")
Jim Broadbent
 
I use the following formula:

WhilePrintingRecords;

numberVar dur;
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;

dur := {MyTable.MyDuration}

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 kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top