Here you can find the source of convertStringToDate(String strDate, String pattern)
public static Date convertStringToDate(String strDate, String pattern)
//package com.java2s; 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 Date convertStringToDate(String strDate, String pattern) { DateFormat df = new SimpleDateFormat(pattern, Locale.US); Date date = null;// w w w . ja v a 2 s .c om strDate = strDate.replace("T", " "); try { date = df.parse(strDate); } catch (ParseException e) { e.printStackTrace(); } return date; } }