Here you can find the source of strToDateWithFormat(String strDate, Format format)
public static Date strToDateWithFormat(String strDate, Format format)
//package com.java2s; //License from project: Apache License import java.text.Format; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date strToDateWithFormat(String strDate, Format format) { SimpleDateFormat localFormat = (SimpleDateFormat) format; ParsePosition pos = new ParsePosition(0); Date strtodate = localFormat.parse(strDate, pos); return strtodate; }// w w w. ja va 2 s. com }