Here you can find the source of formatDate(java.util.Date d, String format)
public static final String formatDate(java.util.Date d, String format)
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Locale; public class Main { public static final String formatDate(java.util.Date d) { DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, new Locale("en")); return df.format(d); }/* ww w .j av a 2 s . c o m*/ public static final String formatDate(java.util.Date d, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(d); } }