totalTimeFromSec(seconds)
Last updated May 09, 2009
Version: 0 | Requires: CF5 | Library: DateLib
Description:
Similar to getTimeFromSeconds, except it's not restricted to 24 hours or less. Function can be used to calculate total duration of time and format it to display as hh:mm:ss
Return Values:
Returns a time object.
Example:
<cfset seconds = 100000>
<cfoutput>#totalTimeFromSec(seconds)#</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
seconds | Number of seconds | Yes |
Full UDF Source:
/**
* Get total time from seconds in hh:mm:ss format
*
* @param seconds Number of seconds (Required)
* @return Returns a time object.
* @author Hamlet Javier (hamlet@igetspanish.com)
* @version 0, May 9, 2009
*/
function totalTimeFromSec(seconds)
{
Var xHr = (seconds\3600); // find hour
Var xMin = (seconds\60) - (xHr*60); // Find minutes
Var xSec = seconds - (xHr * 3600) - (xMin*60); // find seconds
var xTime = "#NumberFormat(xHr,'00')#:#NumberFormat(xMin,'00')#:#NumberFormat(xSec,'00')#"; //return in time format
return xTime;
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016