Here you can find the source of getFormatString(Date date, String dateFormat)
public static String getFormatString(Date date, String dateFormat)
import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Main{ public static String getFormatString(Date date, String dateFormat) { if (date == null || StringUtil.isEmpty(dateFormat)) { return null; }/*from w w w. jav a2s. co m*/ return new SimpleDateFormat(dateFormat, Locale.ENGLISH) .format(date); } }