Here you can find the source of convertStringToDate(String dateInput, String formatter)
public static final Date convertStringToDate(String dateInput, String formatter)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static final Date convertStringToDate(String dateInput, String formatter) { Date date = new Date(); try {//from www . j ava 2 s . c om DateFormat format = new SimpleDateFormat(formatter, Locale.ENGLISH); date = format.parse(dateInput); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return date; } }