Here you can find the source of parseTimestamp(String dateString)
Parameter | Description |
---|---|
dateString | a parameter |
public static Timestamp parseTimestamp(String dateString)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*from w ww.j ava 2s . c om*/ * Convert date string to timestamp. * * @param dateString * @return */ public static Timestamp parseTimestamp(String dateString) { Timestamp timestamp = null; try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS"); Date parsedDate = dateFormat.parse(dateString); timestamp = new Timestamp(parsedDate.getTime()); } catch (Exception e) { e.printStackTrace(); } return timestamp; } }