> > 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
I think I need to use the math for this. How do you get the minutes and
seconds out of a lump sum of seconds? EX: 130 seconds would be 2 minutes 10
seconds What should the code look like to get this?
-JH
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 beta â Build next generation applications today.
Free beta download on Labs
http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:282808
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4