Java tutorial
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static String getHMFormatTime(long time) { return getFormatTime("HH:mm", time); } public static String getFormatTime(String formatter, long time) { SimpleDateFormat format = new SimpleDateFormat(formatter, Locale.getDefault()); return format.format(new Date(time)); } }