4 Replies Latest reply on Jun 28, 2013 7:32 AM by David Andrade

    convert integer to mm:ss

    David Andrade

      Is there a way to convert an integer that is already in seconds to mm:ss?

       

      For example, I have two integers I have divided [sum(x)/sum(y)] to get a total talk time in seconds of 188.90780

       

      If I wanted to get the minutes, I'd divide by 60, so... 188.9078 / 60 = 3.14846

       

      The decimal basically translates to .14846 * 60s = 8.9076 ~ 9 seconds

       

      My answer should bring 3.9 or 3 minutes 9 seconds.

       

      I figured out a way to do this, but it is a really, really long calc that works best as a string and I'm sure someone has a better idea on here.

       

      str(float(left(str((sum([x])/sum([y]))/60),1)))

      +"m, "+

      str(

      if float(left(str((float(str((sum([x])/sum([y]))/60))-float(left(str((sum([x])/sum([y]))/60),1)))*60),2))>10

      then

      left(str((float(str((sum([x])/sum([y]))/60))-float(left(str((sum([x])/sum([y]))/60),1)))*60),2)

      else

      left(str((float(str((sum([x])/sum([y]))/60))-float(left(str((sum([x])/sum([y]))/60),1)))*60),1)

      end)

      + "s"

       

      See what I mean?