Here you can find the source of convertToTimestampHMS(String dateData)
public static Timestamp convertToTimestampHMS(String dateData)
//package com.java2s; import java.sql.Timestamp; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static Timestamp convertToTimestampHMS(String dateData) { if (dateData == null) return null; if (dateData.trim().equals("")) return null; String yearString = dateData.substring(0, 4); String monthString = dateData.substring(4, 6); String dayString = dateData.substring(6, 8); String hourString = dateData.substring(8, 10); String minString = dateData.substring(10, 12); String secString = dateData.substring(12, 14); int year = Integer.parseInt(yearString); int month = Integer.parseInt(monthString) - 1; int day = Integer.parseInt(dayString); int hour = Integer.parseInt(hourString); int min = Integer.parseInt(minString); int sec = Integer.parseInt(secString); Calendar cal = new GregorianCalendar(); cal.set(year, month, day, hour, min, sec); return new Timestamp(cal.getTime().getTime()); }//from ww w .j a v a 2 s . c o m }