Here you can find the source of convertDateToString(Date date)
public static String convertDateToString(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String convertDateToString(Date date) { String result = ""; //SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy"); SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); try {//from w w w.j a v a 2s . co m result = format.format(date); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; } }