Java tutorial
//package com.java2s; import java.sql.Timestamp; import java.text.SimpleDateFormat; public class Main { public static String formatTime(long timestamp) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { return sdf.format(new Timestamp(timestamp)); } catch (Exception e) { e.printStackTrace(); } return String.valueOf(timestamp); } }