Here you can find the source of convertStringToTimestamp(String str)
public static Timestamp convertStringToTimestamp(String str) throws Exception
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; public class Main { public static Timestamp convertStringToTimestamp(String str) throws Exception { //"2011-05-09 11:49:45"; Timestamp ts = new Timestamp(System.currentTimeMillis()); try {/*w w w . j a va 2s. com*/ ts = Timestamp.valueOf(str); } catch (Exception ex) { throw new Exception(ex.getMessage() + str); } return ts; } }