Here you can find the source of getDateByFormat(String strDate, String format)
public static Date getDateByFormat(String strDate, String format)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getDateByFormat(String strDate, String format) { SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat(format); Date date = null;//from www . ja v a 2s . co m try { date = mSimpleDateFormat.parse(strDate); } catch (ParseException e) { e.printStackTrace(); } return date; } }