|
Q3001 Are there any functions in ColdFusion that will convert hours to minutes and minutes to hours?
irt.org | Knowledge Base | ColdFusion | Q3001 [ previous next ]
Q3001 Are there any functions in ColdFusion that will convert hours to minutes and minutes to hours?
There are no predefined functions for this, but see if this sets you in the right direction.
<cfset totalminutes="75">
<!--- convert to hours/minutes --->
<cfset hours = int(totalminutes\60)>
<cfset minutes = int(totalminutes mod 60)>
<cfoutput>#totalminutes# minutes = #hours# hr #minutes# min</cfoutput><br>
<!--- convert back to minutes --->
<cfset newtotalminutes = (hours * 60) + minutes>
<cfoutput>Total minutes = #newtotalminutes#</cfoutput>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.