ConvertLegalHours(hourString)
Last updated July 3, 2002
Version: 1 | Requires: ColdFusion 5 | Library: DateLib
Description:
Converts h:mm:ss or h:mm strings to hours rounded to tenths, used in my case for legal time billing.
Return Values:
Returns a string.
Example:
<cfoutput>#Variables.HoursInTenths#</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| hourString | A string containing the number of hours, minutes, and seconds in the format: H:MM:SS. | Yes |
Full UDF Source:
<cfscript>
/**
* Function that returns legal billing time from standard time format.
*
* @param hourString A string containing the number of hours, minutes, and seconds in the format: H:MM:SS. (Required)
* @return Returns a string.
* @author Joe (jcraven@akingump.com)
* @version 1, July 3, 2002
*/
function ConvertHours(HourString) {
var HourWords = "";
var MinuteVal = Round(val(listGetAt(HourString,2,":"))/6);
var HourVal = listFirst(hourString,":");
if(len(HourVal) is 1) {
if(HourVal is "0") HourWords = '0.';
else HourWords = HourVal & '.';
} else HourWords = HourVal & '.';
HourWords = HourWords & MinuteVal;
return HourWords;
}
</cfscript>
Search CFLib.org
Latest Additions
Tayo Akinmade added
arrayTrim
11 day(s) ago
Will Belden added
longTime
17 day(s) ago
James Sleeman added
quickSort
27 day(s) ago
Ben Forta added
GetHostAddress
30 day(s) ago
Top Rated
EksporSQLData
Rated 5.0, 16 time(s)
backupDatabase
Rated 5.0, 13 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)