Here you can find the source of toDBDate(String str)
public static java.sql.Timestamp toDBDate(String str)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static final String yyyyMMddHHmmssSS = "yyyy-MM-dd HH:mm:ss.SS"; public static java.sql.Timestamp toDBDate(String str) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(yyyyMMddHHmmssSS); try {// www . j a va 2 s . c o m Date date = simpleDateFormat.parse(str); Calendar cal = Calendar.getInstance(); cal.setTime(date); return new java.sql.Timestamp(cal.getTimeInMillis()); } catch (ParseException e) { e.printStackTrace(); } return null; } }