ColdFusion Tutorial
Convert hours to minutes and minutes to hours
There are no predefined functions in CFML for this, so we have to write some lines of code.
The code:
|
<cfset tot_minutes = "145"> <cfoutput>#tot_minutes# minutes: #hours# hours and #minutes# minutes.</cfoutput> <br> <!--- Convert back to minutes ---> Total minutes: <cfoutput>#tot_minutes_back#</cfoutput> |
The output:
145 minutes: 2 hours and 25 minutes.
Total minutes: 145
ColdFusion Tutorial test
Convert hours to minutes and minutes to hours
No test is available or implemented for this ColdFusion Tutorial.
User Comments: 1
Converting minutes to hours....
how do I convert minutes to hours by using a simple dividing technique?
Sample: 150 minutes = 2 1/2 hours.
I can do that one in my head (!!) but if it comes to larger numbers, this becomes more difficult...
We need an answer that breaks down to hours and then 1/4, 1/2 and 3/4 hours.
What simple way is there to do that?
