Java tutorial
//package com.java2s; import java.sql.Timestamp; import java.text.SimpleDateFormat; public class Main { public static String TimestampToString(Timestamp timestamp, String pattern) { SimpleDateFormat df = new SimpleDateFormat(pattern); try { return df.format(timestamp); } catch (Exception e) { return ""; } } }