Here you can find the source of convertTimestampToString(Timestamp str)
public static String convertTimestampToString(Timestamp str)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; public class Main { public static String convertTimestampToString(Timestamp str) { return convertTimestampToString(str, "yyyy-MM-dd HH:mm:ss"); }//from ww w . j av a 2 s . c o m public static String convertTimestampToString(Timestamp str, String format) { //Timestamp ts = new Timestamp(System.currentTimeMillis()); String tsStr = ""; DateFormat sdf = new SimpleDateFormat(format); tsStr = sdf.format(str); //System.out.println(tsStr); return tsStr; } }