Here you can find the source of strToTimestamp(String dateStr)
public static Timestamp strToTimestamp(String dateStr)
//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 SimpleDateFormat formatTimestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static Timestamp strToTimestamp(String dateStr) { return Timestamp.valueOf(dateStr); }/* www .j ava 2 s . c o m*/ public static Timestamp strToTimestamp(Date date) { return Timestamp.valueOf(formatTimestamp.format(date)); } }