Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getTimeFormat(String format, Date date) { SimpleDateFormat f = new SimpleDateFormat(format); return f.format(date); } public static String getTimeFormat(String format, long timestamp) { return getTimeFormat(format, new Date(timestamp * 1000)); } }