Page 1 of 1

Parsing a number

PostPosted: Wed Jun 23, 2010 7:16 pm
by stevec
I have the time in seconds;

for example 274.61 sec

I have the number divided by 60 for minutes, the result is 4.58

The .58 needs to be converted to 32 for the sec.

How dod you parse teh variable 4.58 into 4 and 58 and then
convert the 58.

Then I could place the two variables togather and come up with the
4 min 32 sec.


Current commands;

Math "[MediaPlayer1]/1000" "2" "[MediaPlayer2]"

Math "([MediaPlayer2]/60)*.6" "2" "[MediaPlayer3]"
Ideas

Thanks;

I HOPE HELP YOU

PostPosted: Wed Jun 23, 2010 9:23 pm
by virger
Try this:

.. trunc(x) is the greatest integer less than or equal to x.
setvar "[data]" "274.61"

..133 min, 59.59 sec == 8039.59
setvar "[data]" "8039.59"


.1) way
math "trunc([data]/60)" "" "[min]"
math "trunc([data]-([min]*60))" "" "[sec]"

.2) way
math "[data]/60" "2" "[res]"
strparse "[res]" "." "[ms]" "[dummy]"
setvar "[min]" "[ms1]"
math "[ms2]*.60" "" "[sec]"

PURA VIDA
FROM COSTA RICA
AMERICA CENTRAL

PostPosted: Fri Jun 25, 2010 2:36 pm
by stevec
Thanks will try it.
Sorry for the delay in seeing the post.