I need this string to output in the format 00:00:00 currently it goes out: 5: 4: 1 For example, what I did was do several ifs, but it is not efficient, and it also does not format when the 3 are below 10:
long diffSeconds2 = long_hours / 1000 % 60;
long diffMinutes2 = long_hours / (60 * 1000) % 60;
long diffHours2 = long_hours / (60 * 60 * 1000) % 24;
if (long_hours > 0) {
if(diffSeconds2<10){
str_testing = diffHours2 + ":" + diffMinutes2 + ":0" +diffSeconds2;
}else if(diffMinutes2<10){
str_testing = diffHours2 + ":0" + diffMinutes2 + ":" +diffSeconds2;
}else if(diffHours2<10){
str_testing = "0" + diffHours2 + ":" + diffMinutes2 + ":" +diffSeconds2;
}
//e se for os 3 abaixo de 10 teria que ficar: 00:00:00