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

Summing Time, timeformat()...Over 24 hours???

Status
Not open for further replies.

DeZiner

Programmer
May 17, 2001
815
US
I am storing times in an array. The times are generally 2-45 minutes some hit 2hours. I store the reults of a query of time in an array then sum it. It works great unless the total time exceeds 24 hours. After 24 hours it starts over. How can I get the clock to just keep adding time as anumber rather than as days, or alternatively how can I add a day part to the timeformat? DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Any ideas to at leat convert to Days - Hours - Minutes? DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Know any other source I may be able to solve this at?

Another example > If total time is 29 hours and 10 minutes, either display 29:10 or 1day, 5:10

Thanks. DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
No one wants to help you, huh? :)

I just did something similar in a function in sql server. The way we did it was to calculate everything in minutes and then divide it out from there.

basically:

<cfset totalDays = fix(totalminutes / 1440)>
<cfset remainderHours = fix((totalMinutes MOD 1440) / 60)>
<cfset remainderMins = totalMinutes mod 60>

<cfoutput>#totalDays# days #remainderHours# hours and #remainderMins# minutes</cfoutput>

You might want to check out cflib.org -- I think they have a udf that may be a little easier to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top