0

My problems is that I have this value...75 seconds and I want to display in my Grid like 1:15 minutes... How can I do this ?

I'm trying this...

    xmlCttSemAcao = new XMLListCollection(event.result..CTT);
    var i:int = 0;

    for each(var node:XML in xmlCttSemAcao)
    {
        xmlCttSemAcao[i].@DUR_CTT = (xmlCttSemAcao[i].@DUR_CTT / 60) %60;
        i++;
    }

    xmlCttSemAcao.refresh();
    gp2.refresh();

But my result for this example is: 1:25

Another example...56 seconds is displaying 0.933333

ketan
  • 19,129
  • 42
  • 60
  • 98
Daniel
  • 125
  • 6
  • In JavaScript, but the method transfers to ActionScript 3.0: http://stackoverflow.com/questions/3733227/javascript-seconds-to-minutes-and-seconds – net.uk.sweet Apr 22 '15 at 19:25

1 Answers1

1

First, split it up a bit, then calculate seconds and minutes before putting them together:

for each(var node:XML in xmlCttSemAcao)
{
    var durCtt:int = xmlCttSemAcao[i].@DUR_CTT;
    var seconds:int = durCtt % 60;
    var minutes:int = durCtt / 60;
    var timeDisplay:String = minutes + ":" + seconds;
    xmlCttSemAcao[i].@DUR_CTT = timeDisplay;
    i++;
}
Brian
  • 3,850
  • 3
  • 21
  • 37