Here's a fun, non-utilitarian way to do it while making code unreadable and
abusing your database (or that is to say in the tradition of YAPH):

<cfset t=5600.25/24>
<cfquery datasource="cfUserDSN" name="q">
        select CAST(#t# as datetime) as mydate
</cfquery>
<cfoutput>
        #decrementValue(datePart('y',q.mydate))# days,
#datePart('h',q.mydate)# hours, #datePart('n',q.mydate)# minutes,
#datePart('s',q.mydate)# seconds
</cfoutput> 

{at least in SQL which stores date time as days since jan first, 1900)


-----Original Message-----
From: Jason Larson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 2:39 PM
To: CF-Talk
Subject: RE: Converting Seconds to Hours,Minutes,Seconds


Thanks, that's what I was looking for.

Jason

-----Original Message-----
From: Daniel Lancelot [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 1:33 PM
To: CF-Talk
Subject: RE: Converting Seconds to Hours,Minutes,Seconds


Try this - it works...

<cfscript>
        numsecs = 5600.25;
        hours = int(numsecs/3600);
        minutes = int((numsecs / 60) - (hours * 60));
        seconds = numsecs - (hours * 3600) - (minutes * 60);
</cfscript>
<cfoutput>
#hours#:#minutes#:#seconds#
</cfoutput>

-----Original Message-----
From: Jason Larson [mailto:[EMAIL PROTECTED]]
Sent: 20 March 2001 20:01
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

Reply via email to