1 Reply Latest reply: Nov 25, 2012 11:29 AM by 975668 RSS

    sum hours

    975668
      Good afternon,

      I have a counter that returns the time in this format 00:00:00.
      I need to add the previous number plus the number rescente. how to do this?

      Total = 00:00:00 + 00:00:00;
        • 1. Re: sum hours
          975668
          I sorry!
          I solved this question.

          Totaltempo1 = lb_total_cons.getText().split(":");
          Totaltempo2 = lbTempoVer.getText().split(":");

          int horasfinal = Integer.parseInt(Totaltempo1[0])+ Integer.parseInt(Totaltempo2[0]);
          long minutosfinal = (Long.parseLong(Totaltempo1[1])+Long.parseLong(Totaltempo2[1]))%60;
          long segundosfinal = (Long.parseLong(Totaltempo1[2])+Long.parseLong(Totaltempo2[2]))%60;

          lb_total_cons.setText(DuasCasas.format(horasfinal)+":"+DuasCasas.format(minutosfinal)+":"+DuasCasas.format(segundosfinal));