Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.