Here you can find the source of timeStampFormat(Timestamp t)
public static Date timeStampFormat(Timestamp t)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date timeStampFormat(Timestamp t) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); dateFormat.format(t);//from w w w . jav a 2 s. co m Date d = null; try { d = dateFormat.parse(dateFormat.format(t)); } catch (ParseException e) { e.printStackTrace(); } return d; } }