Time to be Added together

TimeWorked
09:05:25
09:30:15
10:15:01
08:19:49
09:17:40

Code

int hour = 0;
int minute = 0;

for() {
    String[] rowtime= row[i].split(":");
    hour += Integer.parseInt(rowtime[0]);
    minute += Integer.parseInt(rowtime[1]);
}

hour += minute / 60;
minute %= 60;

String result = hour + ":" + minute

if(minute<10)
  Nmin = "0"+ String.valueOf(minute);
else
  Nmin = String.valueOf(minute);
		
 String result = hour + ":" + Nmin;

Leave a reply