Here you can find the source of convertStringToDate(String input)
public static Date convertStringToDate(String input)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { static final String DATEFORMAT = "yyyy-MM-dd HH:mm:ss"; public static Date convertStringToDate(String input) { SimpleDateFormat formatter = new SimpleDateFormat(DATEFORMAT); Date date = null;/*from www.ja v a 2s . c o m*/ try { date = formatter.parse(input); } catch (ParseException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } return date; } }