> which returns 10:24.
> 
> I need to get the 1:36 now.  

First off - forget the format.  Format means nothing.

I would think the easiest thing to do would be to (conceptually) treat every 
period like it began at exactly midnight.  You can then use the methods 
described in my first post to create the time (using zero for hours and your 
retrieved numbers for minutes and seconds).

So if it's 1024 you'd end up with:

<cfset myTime = createTime(0, 10, 24)>

Conceptually we also know that the period ended at 12 minutes after midnight, 
or:

<cfset PeriodEnd = createTime(0, 12, 0)>

You could, of course, use the actual time of the period, but it doesn't really 
matter - you're after the duration here, not the actual time.

You can then (has others have suggested) the dataDiff() function to get the 
difference (presumably in seconds) between the two.  You can then divide the 
answer by 60 to get minutes (and the remainder - use the modulo operator - 
would be your seconds).

I think that would be easiest.  You don't really NEED to create actual time 
instances however - you can do it all with math:

First get the total number of seconds:

<cfset PeriodDuration = 12 x 60>

Then split the input as I described in my original post:

<cfset Input = Right("0000" & Input, 4)>
<cfset MyTime = ( Left(Input, 2) * 60 ) + Right(Input, 2)>

Personally I think using real times is "better" but that could just be me - 
doing the simple math might be faster as well.

Hope this helps,

Jim Davis

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:282738
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to