Here you can find the source of formatDate(java.util.Date date, String pattern)
public static String formatDate(java.util.Date date, String pattern) throws Throwable
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; public class Main { public static String formatDate(java.util.Date date, Boolean withTime, Boolean setTimeToNull) throws Throwable { // Format the new date in MF date format\ if (withTime) { if (setTimeToNull) { return formatDate(date, "dd-MMM-yyyy 00:00:00"); } else { return formatDate(date, "dd-MMM-yyyy HH:mm:ss"); }// w w w . ja v a 2 s . c om } else { return formatDate(date, "dd-MMM-yyyy"); } } public static String formatDate(java.util.Date date, String pattern) throws Throwable { // Format the new date in MF date format SimpleDateFormat formatterOut = new SimpleDateFormat(pattern); return formatterOut.format(date); } }