Here you can find the source of toDateString(Date date)
public static String toDateString(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String Format_Date = "yyyy-MM-dd"; public static String toDateString(Date date) { if (date == null) { return ""; }/*from w w w . j a v a 2s . c o m*/ return new SimpleDateFormat(Format_Date).format(date); } }