Android examples for java.util:Date Time
Get a readable string displaying the time
import android.content.Context; import android.graphics.Paint; import com.android.videoeditor.R; import java.util.Random; public class Main{ /**/*from w w w. j a v a 2 s . c om*/ * * * @param context The context (needed only for relative time) * @param time The time * * @return The time string */ public static String getSimpleTimestampAsString(Context context, long time) { final long hours = time / 3600000; time %= 3600000; final long mins = time / 60000; time %= 60000; final long sec = time / 1000; return String.format("%02d:%02d:%02d", hours, mins, sec); } }