Here you can find the source of dateToStr(java.util.Date date)
public static String dateToStr(java.util.Date date)
//package com.java2s; import java.text.SimpleDateFormat; public class Main { private static final String simDateFormat = "yyyy-MM-dd"; public static String dateToStr(java.sql.Date sqlDate) { if (sqlDate == null) { return null; } else {/*from w w w.j ava 2 s . c o m*/ return (new SimpleDateFormat(simDateFormat)).format(sqlDate); } } public static String dateToStr(java.util.Date date) { if (date == null) { return null; } else { return (new SimpleDateFormat(simDateFormat)).format(date); } } }