Here you can find the source of String2Timestamp(String strInputDate)
public static java.sql.Timestamp String2Timestamp(String strInputDate)
//package com.java2s; public class Main { public static java.sql.Timestamp String2Timestamp(String strInputDate) { String strDate = strInputDate; int i, nYear, nMonth, nDay; String strSub = null;/*w w w. j a v a2s . c o m*/ i = strDate.indexOf("/"); if (i < 0) { return createTimestamp(); } strSub = strDate.substring(0, i); nDay = (new Integer(strSub.trim())).intValue(); strDate = strDate.substring(i + 1); i = strDate.indexOf("/"); if (i < 0) { return createTimestamp(); } strSub = strDate.substring(0, i); nMonth = (new Integer(strSub.trim())).intValue() - 1; // Month begin from 0 value strDate = strDate.substring(i + 1); if (strDate.length() < 4) { if (strDate.substring(0, 1).equals("9")) { strDate = "19" + strDate.trim(); } else { strDate = "20" + strDate.trim(); } } nYear = (new Integer(strDate)).intValue(); java.util.Calendar calendar = java.util.Calendar.getInstance(); calendar.set(nYear, nMonth, nDay); return new java.sql.Timestamp((calendar.getTime()).getTime()); } public static java.sql.Timestamp createTimestamp() { java.util.Calendar calendar = java.util.Calendar.getInstance(); return new java.sql.Timestamp((calendar.getTime()).getTime()); } }