Here you can find the source of fmtDate(Date date)
public static String fmtDate(Date date)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static String fmtDate(Date date) { if (null == date) { return null; }/* w w w .j a va2s .c o m*/ try { SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.US); return sdf.format(date); } catch (Exception e) { return null; } } }