Here you can find the source of formatDuration(final long milliSeconds)
Parameter | Description |
---|---|
time | in millis |
public static String formatDuration(final long milliSeconds)
//package com.java2s; // ProjectForge is dual-licensed. public class Main { /**/* w w w. ja va 2s .co m*/ * @return Formatted string without seconds, such as 5:45. * @param time in millis */ public static String formatDuration(final long milliSeconds) { final long duration = milliSeconds / 60000; final long durationHours = duration / 60; final long durationMinutes = (duration % 60); final StringBuffer buf = new StringBuffer(10); buf.append(durationHours); if (durationMinutes < 10) buf.append(":0"); else buf.append(':'); buf.append(durationMinutes); return buf.toString(); } }