Here you can find the source of formatDateTime(java.util.Date date)
public static String formatDateTime(java.util.Date date)
//package com.java2s; import java.text.SimpleDateFormat; public class Main { public final static String DEFAULT_DATE_FROMAT = "yyyyMMddHHmmss"; public static String formatDateTime(java.util.Date date) { return formatDateTime(DEFAULT_DATE_FROMAT, date); }/* w ww . j a v a 2s .c om*/ public static String formatDateTime(String pattern, java.util.Date date) { String strDate = null; String strFormat = pattern; SimpleDateFormat dateFormat = null; if (date == null) return ""; dateFormat = new SimpleDateFormat(strFormat); strDate = dateFormat.format(date); return strDate; } }