Here you can find the source of getFormattedTime(final Date date)
public static String getFormattedTime(final Date date)
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String SIMPLE_DATE_FORMAT = "yyyyMMddHHmmss"; public static String getFormattedTime(final Date date) { if (date == null) { return null; }//from w w w.ja va 2s. c o m return createSimpleFormat().format(date); } private static DateFormat createSimpleFormat() { return new SimpleDateFormat(SIMPLE_DATE_FORMAT); } }