Here you can find the source of parseTimestamp(String strDate)
public static final Timestamp parseTimestamp(String strDate)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final Timestamp parseTimestamp(String strDate) { try {// ww w . j a va 2s . com // Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff] Timestamp result = Timestamp.valueOf(strDate); return result; } catch (Exception pe) { return null; } } /** * @param strDate * @param format * @return */ public static final Timestamp parseTimestamp(String strDate, String pattern) { Date date = null; try { SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); date = dateFormat.parse(strDate); return new Timestamp(date.getTime()); } catch (Exception pe) { return null; } } }