Here you can find the source of getFormatTime(Date date)
public static String getFormatTime(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getFormatTime(Date date) { return getFormatDateTime(date, "yyyy-MM-dd HH:mm:ss"); }/*from w w w.ja v a 2 s.c om*/ public static String getFormatDateTime(Date date, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); } }