Here you can find the source of toString(Date date)
public static String toString(Date date)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String toString(Date date) { if (date == null) { return ""; }// w w w. jav a 2 s . c o m SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(date); } public static Object toString(Timestamp timestamp) { if (timestamp == null) { return ""; } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(timestamp); } }