A easy way to do it, if the format is the one you have pointed, without have to worry in convert the Date is the following:
int totalSum = getSecondsFromDate("05:12:02") + getSecondsFromDate("19:12:52") + getSecondsFromDate("40:12:14") + getSecondsFromDate("56:54:10") + getSecondsFromDate("41:12:12");
private int getSecondsFromDate(String date){
//We split the date to have hours, minutes and seconds
String splitDate = date.split(":");
int hours = Integer.parseInt(splitDate[0]);
int minutes = Integer.parseInt(splitDate[1]);
int seconds = Integer.parseInt(splitDate[2]);
int totalSeconds = (hours*60*60) + (minutes*60) + seconds;
return totalSeconds;
}
2
solved Android : how can I add 5 Times in a variable and get total seconds of them