Here you can find the source of format(Date date)
public static String format(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static String defaultDatePattern = "yyyy-MM-dd"; public static String format(Date date) { return date == null ? "" : format(date, getDatePattern()); }//from w w w. ja va 2s.c o m public static String format(Date date, String pattern) { return date == null ? "" : new SimpleDateFormat(pattern).format(date); } public static String getDatePattern() { return defaultDatePattern; } }