Here you can find the source of ToDateStr(Date dt)
public static String ToDateStr(Date dt)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String ToDateStr(Date dt) { if (dt == null) return ""; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(dt); }/* ww w . jav a 2s . c o m*/ }