Here you can find the source of formatDateMedium(Date date)
public static String formatDateMedium(Date date)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String formatDateMedium(Date date) { return DateFormat.getDateInstance(DateFormat.MEDIUM).format(date); }// w ww . j a v a 2s. c o m public static String format() { return toInfo(getCalendar()); } /** * @param date */ public static String toInfo(Date date) { return toInfo(date, "yyyy-MM-dd HH:mm:ss"); } /** * @return */ public static String toInfo() { return toInfo(getCalendar().getTime(), "yyyy-MM-dd"); } /** * @param date * @param dateFromat */ public static String toInfo(Date date, String dateFromat) { SimpleDateFormat format = new SimpleDateFormat(dateFromat); return format.format(date); } /** * @param calendar */ public static String toInfo(Calendar calendar) { return toInfo(calendar.getTime()); } public static Calendar getCalendar() { return Calendar.getInstance(); } public static long getTime() { return getTime(getCalendar()); } public static long getTime(Calendar c) { return c.getTimeInMillis(); } }