38 How to convert Milliseconds to “X mins, x seconds” in Java?
String.format("%02d min, %02d sec",
TimeUnit.MILLISECONDS.toMinutes(millis),
TimeUnit.MILLISECONDS.toSeconds(millis) -
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis))
);
|
http://programdoubledragon.blogspot.hk/2014/11/java_6.html
|