Here you can find the source of getLongDateString(Date date)
public static String getLongDateString(Date date)
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public final static String shortFormat = "yyyyMMdd"; public final static String longFormat = "yyyyMMddHHmmss"; public static String getLongDateString(Date date) { DateFormat dateFormat = new SimpleDateFormat(longFormat); return getDateString(date, dateFormat); }/*from ww w . j a va2 s .c o m*/ public static String getDateString(Date date, DateFormat dateFormat) { if (date == null || dateFormat == null) { return null; } return dateFormat.format(date); } public static String getDateString(Date date) { DateFormat df = getNewDateFormat(shortFormat); return df.format(date); } public static String format(Date date, String format) { if (date == null) { return null; } return new SimpleDateFormat(format).format(date); } public static DateFormat getNewDateFormat(String pattern) { DateFormat df = new SimpleDateFormat(pattern); df.setLenient(false); return df; } }