Android examples for java.util:Date Time
format Time using String.format
//package com.java2s; public class Main { public static String formatTime(long millis) { int seconds = (int) (millis / 1000) % 60; int minutes = (int) ((millis / 1000) / 60); return String.format("%02d : %02d", new Object[] { minutes, seconds }); }// ww w. j av a 2s. c o m }