How to convert from java.sql.Timestamp to java.util.Date?

后端 未结 8 1518
心在旅途
心在旅途 2020-12-03 02:49

i.e. this code

startDate = new Date(timestampValue.getTime));

gives me :

2012-16-02 05:16:17

8条回答
  •  时光说笑
    2020-12-03 03:15

    The fancy new Java 8 way is Date.from(timestamp.toInstant()). See my similar answer elsewhere.

提交回复
热议问题