Here you can find the source of parseTimeStamp(String timeStampString)
Parameter | Description |
---|---|
timeStampString | the time stamp string |
public static Timestamp parseTimeStamp(String timeStampString)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**// www.ja va 2 s . co m * parse timestamp. * * @param timeStampString the time stamp string * @return the timestamp */ public static Timestamp parseTimeStamp(String timeStampString) { Timestamp result = null; try { SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.S"); Date parsed = format.parse(timeStampString); result = new Timestamp(parsed.getTime()); } catch (ParseException pe) { System.out.println("ERROR: Cannot parse \"" + timeStampString + "\""); } catch (Exception x) { x.printStackTrace(); } return result; } }