Here you can find the source of convertStringToSql(final String dateStr)
public static Timestamp convertStringToSql(final String dateStr) throws ParseException
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); public static Timestamp convertStringToSql(final String dateStr) throws ParseException { return new Timestamp(format.parse(dateStr).getTime()); }//from w w w . j a v a2s . c o m }