Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { public static String getMsgTime(long msg_time) { Calendar cl = Calendar.getInstance(); cl.setTimeInMillis(msg_time); //here your time in miliseconds String hour = String.format("%02d", cl.get(Calendar.HOUR_OF_DAY)); String min = String.format("%02d", cl.get(Calendar.MINUTE)); String sec = String.format("%02d", cl.get(Calendar.SECOND)); String time = hour + ":" + min; return time; } }