Here you can find the source of formatDate(String Format)
public static String formatDate(String Format)
//package com.java2s; import java.text.*; import java.util.*; public class Main { public static String formatDate(String Format) { java.util.Date d = Calendar.getInstance().getTime(); try {//from w w w . j a v a 2 s . co m SimpleDateFormat f = new SimpleDateFormat(Format); return f.format(d); } catch (Exception e) { SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); // :iii return f.format(d); } } public static String formatDate(Date date) { String dateformat = "yyyy-MM-dd HH:mm"; return formatDate(date, dateformat); } public static String formatDate(Date date, String dateformat) { SimpleDateFormat sdf = new SimpleDateFormat(dateformat); return sdf.format(date); } public String getTime() { java.sql.Time ent = new java.sql.Time(System.currentTimeMillis()); return ent.toString(); } }