Here you can find the source of convertToTimestamp(String s)
public static Timestamp convertToTimestamp(String s)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static Timestamp convertToTimestamp(String s) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS"); Timestamp timestamp = null; try {/*from w ww . j a v a 2s . com*/ timestamp = new Timestamp(dateFormat.parse(s).getTime()); } catch (ParseException e) { e.printStackTrace(); } return timestamp; } }