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