Here you can find the source of formatDateByDefault(Date date)
public static String formatDateByDefault(Date date)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String PATTERN_DEFAULT = "yyyy/MM/dd HH:mm:ss"; public static String formatDateByDefault(Date date) { if (null == date) { return null; }//from w w w. j ava 2s .co m DateFormat df = new SimpleDateFormat(PATTERN_DEFAULT); String dateStr = df.format(date); return dateStr; } }