Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static String getHour(long time) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(time); int hour = c.get(Calendar.HOUR_OF_DAY); int minute = c.get(Calendar.MINUTE); String times = "" + hour; if (minute < 10) { times += ":0" + minute; } else { times += ":" + minute; } return times; } }