Here you can find the source of toString(Date date, String dateFormat)
public static String toString(Date date, String dateFormat)
//package com.java2s; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String toString(Date date) { return toString(date, "dd/MM/yyyy"); }// ww w.ja v a2 s. c om public static String toString(Date date, String dateFormat) { SimpleDateFormat formatter = new SimpleDateFormat(dateFormat); return formatter.format(date); } public static String toString(java.sql.Date date) { return toString(date, "dd/MM/yyyy"); } public static String toString(java.sql.Date date, String dateFormat) { SimpleDateFormat formatter = new SimpleDateFormat(dateFormat); return formatter.format(date); } public static String toString(Timestamp timeStampDate) { return toString(timeStampDate, "dd/MM/yyyy"); } public static String toString(Timestamp timeStampDate, String dateFormat) { SimpleDateFormat formatter = new SimpleDateFormat(dateFormat); return formatter.format(timeStampDate); } }