Here you can find the source of string2DateTime(String stringDate)
public static final Date string2DateTime(String stringDate) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String simple = "yyyy-MM-dd HH:mm:ss"; public static final Date string2DateTime(String stringDate) throws ParseException { if (stringDate == null) { return null; }//from w w w .j av a 2 s . c o m return getFormat(simple).parse(stringDate); } private static final DateFormat getFormat(String format) { return new SimpleDateFormat(format); } }