Here you can find the source of getDateFromFormat(Date date, String type)
public static String getDateFromFormat(Date date, String type)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getDateFromFormat(Date date, String type) { SimpleDateFormat dateForma = getSimpleDateFormatsType(type); return dateForma.format(date); }//from w w w . j a v a 2 s . com /** * SimpleDateFormat * @param type * @return */ public static SimpleDateFormat getSimpleDateFormatsType(String type) { SimpleDateFormat dateFormat = new SimpleDateFormat(type);// return dateFormat; } }