Here you can find the source of formatTime(long timeInMillis)
public static String formatTime(long timeInMillis)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String TIME_FORMAT = "HH:mm"; public static String formatTime(long timeInMillis) { return format(TIME_FORMAT, timeInMillis); }/*from w w w .j a v a 2s .com*/ private static String format(String pattern, long timeInMillis) { final SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(new Date(timeInMillis)); } }