Here you can find the source of formatDate(Date date, String pattern)
public static String formatDate(Date date, String pattern)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static String formatDate(Date date, String pattern) { return formatDate(date, pattern, Locale.getDefault()); }//from w w w . j ava2 s.c o m public static String formatDate(Date date, String pattern, Locale locale) { SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, locale); return dateFormat.format(date); } }