Here you can find the source of format(Date date, String parttern)
public static String format(Date date, String parttern)
//package com.java2s; //License from project: LGPL import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static String format(Date date, String parttern) { if (date == null) { return ""; }/*from w ww .jav a 2s . c o m*/ if (parttern == null || parttern.equals("")) { return ""; } SimpleDateFormat formater = new SimpleDateFormat(parttern, Locale.ENGLISH); return formater.format(date); } }