Get Elapsed Time Minutes Seconds String
class TimeUtil {
public static String getElapsedTimeMinutesSecondsString(int miliseconds) {
int elapsedTime = miliseconds;
String format = String.format("%%0%dd", 2);
elapsedTime = elapsedTime / 1000;
String seconds = String.format(format, elapsedTime % 60);
String minutes = String.format(format, elapsedTime / 60);
return minutes + ":" + seconds;
}
}
Related examples in the same category