Here you can find the source of formatDateToCustfmt(java.util.Date date, String dateFmt)
public static Date formatDateToCustfmt(java.util.Date date, String dateFmt)
//package com.java2s; import java.util.Date; public class Main { public static Date formatDateToCustfmt(java.util.Date date, String dateFmt) { if (date == null) { return null; }/*from w w w . ja v a2 s. c o m*/ java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat(dateFmt); return java.sql.Date.valueOf(dateFormat.format(date)); } }