Here you can find the source of toDateString(final Date date)
public static final String toDateString(final Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String defaultDatePattern = "yyyy-MM-dd HH:mm"; public static final String toDateString(final Date date, final String pattern) { final SimpleDateFormat sdf = new SimpleDateFormat(pattern); return date == null ? null : sdf.format(date); }/* w w w .ja v a2s. co m*/ public static final String toDateString(final Date date) { return toDateString(date, defaultDatePattern); } }