Here you can find the source of formatAllDate(Date date)
public static String formatAllDate(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String defaultDatePattern = "yyyy-MM-dd"; public static String defaultDatePattern1 = "yyyy-MM-dd HH:mm:ss"; public static String formatAllDate(Date date) { return format(date, defaultDatePattern1); }// w w w .j a v a2 s . c o m public static String format(Date date) { return format(date, getDatePattern()); } public static String format(Date date, String pattern) { String returnValue = ""; if (date != null) { SimpleDateFormat df = new SimpleDateFormat(pattern); returnValue = df.format(date); } return (returnValue); } public static String getDatePattern() { return defaultDatePattern; } }