Here you can find the source of formatString(Timestamp da)
public static String formatString(Timestamp da)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.SimpleDateFormat; public class Main { public static String formatString(Timestamp da) { String datastring = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); datastring = sdf.format(da);// w ww.j a v a 2 s . co m return datastring; } public static String formatString(Timestamp da, String format) { String datastring = null; SimpleDateFormat sdf = new SimpleDateFormat(format); datastring = sdf.format(da); return datastring; } }