Here you can find the source of String2Timestamp(String s, String fmt)
public static Timestamp String2Timestamp(String s, String fmt)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Timestamp String2Timestamp(String s, String fmt) { Timestamp ts = new Timestamp(new Date().getTime()); try {//from w ww . j a va 2 s . c o m SimpleDateFormat df = new SimpleDateFormat(fmt); ts = new Timestamp(df.parse(s).getTime()); return ts; } catch (Exception ex) { } return ts; } }