Here you can find the source of formatDate(Timestamp time)
public static String formatDate(Timestamp time)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String formatDate(Timestamp time) { return formatDate(new java.util.Date(time.getTime())); }//from w w w . j a va 2 s. co m public static String formatDate(java.sql.Date date) { return formatDate(new java.util.Date(date.getTime())); } public static String formatDate(Date date) { return formatDate(date, "yyyy-MM-dd HH:mm:ss"); } public static String formatDate(java.util.Date date, String pattern) { if (date == null) { return ""; } SimpleDateFormat format = new SimpleDateFormat(pattern); return format.format(date); } }