Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Locale; import java.util.concurrent.TimeUnit; public class Main { public static String getFormattedTimeInterval(long millis) { return String.format(Locale.US, "%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(millis), TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis))); } }