Android examples for java.util:Date Time
Calculate hour minute and second from milli seconds
import android.text.format.DateUtils; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main{ public static String getDates(long mTimeLine) { mTimeLine = mTimeLine / 1000;/*ww w . j a va 2 s. c o m*/ int hour = (int) mTimeLine / 3600; int minute = (int) (mTimeLine - (hour * 3600)) / 60; int second = (int) mTimeLine - (hour * 3600 + minute * 60); return (hour < 10 ? "0" + hour : hour) + ":" + (minute < 10 ? "0" + minute : minute) + ":" + (second < 10 ? "0" + second : second); } }