Some simple code. There are other ways, but I think this is most straight
forward
<cfset seconds=5000>
<cfset hours = seconds \ (3600)>
<cfset seconds = seconds mod 3600>
<cfset mins = seconds \ (60)>
<cfset seconds = seconds mod 60>
<cfoutput>#hours#:#mins#:#seconds#</cfoutput>
A note on CF division operators. The forward slash "/" returns a fractional
result. Using a back slash "\" returns an integer value as the DIV operator
(divides and drops the remainder) Example, 9/2 = 4.5. 9\2=4.
Brian
-----Original Message-----
From: Jason Larson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 3:01 PM
To: CF-Talk
Subject: Converting Seconds to Hours,Minutes,Seconds
I was wondering if there is anybody out there that has a piece of code that
will help me solve my little problem that I am having? I need to take a
number i.e. 5600.25 seconds, and find out how many hours are in that number,
how many minutes, and how many seconds are remaining. New to CF, and I am
struggling a little bit on this one.
Thanks for your help
Jason Larson
[EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists