Here you can find the source of convertToString(Date date)
public static String convertToString(Date date)
//package com.java2s; import java.text.*; import java.util.*; public class Main { public static String convertToString(Date date) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); try {/*from w w w. j av a 2 s . c o m*/ return formatter.format(date); } catch (Exception e) { // e.printStackTrace(); return null; } } }