Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q3001 Are there any functions in ColdFusion that will convert hours to minutes and minutes to hours?

You are here: irt.org | FAQ | ColdFusion | Q3001 [ previous next ]

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>

©2018 Martin Webb