Java tutorial
//package com.java2s; import java.util.concurrent.TimeUnit; public class Main { /** @param time input in milliseconds TODO: covert to seconds */ public static String formatTimeMinutes(long time) { return String.format("%02d:%02d", TimeUnit.MILLISECONDS.toHours(time), TimeUnit.MILLISECONDS.toMinutes(time) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(time))); } }