Convert Java String to sql.Timestamp

前端 未结 5 904

Got a String coming in with this format: YYYY-MM-DD-HH.MM.SS.NNNNNN The Timestamp is coming from a DB2 database. I need to parse it into a java.sql.Timestamp and NOT lose a

5条回答
  •  广开言路
    2020-12-02 13:50

    If you get time as string in format such as 1441963946053 you simply could do something as following:

    //String timestamp;
    Long miliseconds = Long.valueOf(timestamp);
    Timestamp ti = new Timestamp(miliseconds);
    

提交回复
热议问题