Coldfusion DateDiff - How to show as Hours and Minutes

I'm using DateDiff to display a 'countdown' to an expiry date - pulling the expiry date/time from a field in the database, and comparing it against the current time.

I then use CFSET to display the number of hours and a separate one for minutes, however the minutes are the total minutes (i.e 2 Hours displays as 2 Hours / 120 Minutes).

The Hour and Minutes display are shown seperately (for styling purposes), so I need them to be displayed as separate elements.  

So, effectively what I want to display is (assuming the expiry time is 2 hours, 15 minutes away);

2 Hours
15 Minutes

This is what I have so far to work with;

<cfset e_hours = #datediff("h",now(),expires)#>
<cfset e_mins = #datediff("n",now(),expires)#>

I'm fairly sure I can simply do some mathematical additions to the minutes to remove the hours from the figure, but everything I've tried so far has not been accurate.  Any pointers much appreciated!
MaxafiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SidFishesCommented:
this should work for you

<cfset expires="01/30/2008 3:32 PM">

<cfset e_hours = #datediff("h",now(),expires)#>
<cfset e_mins = #datediff("N",now(),expires)#>

<cfoutput>
To Expiry = #e_hours# Hours #((e_mins/60)-e_hours)*60# Minutes
</cfoutput>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MaxafiAuthor Commented:
Works perfectly, thanks! :-)
0
rob_lorentzCommented:
try something like this......

<cfset t_now = now()>

<cfset expires = DateAdd("n", 39, t_now)>  <!--- bogus expire time --->

<cfset e_hours = datediff("h", t_now, expires )>
<cfset e_mins = datediff("n", t_now, dateAdd("h", (e_hours * -1), expires))>

<cfoutput>
 expires #expires#<br>
 e_hours #e_hours#<br>
 e_mins #e_mins#<br>
</cfoutput>


of course
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.