java.util.Date to java.sql.Date doesn't contain Time

前端 未结 4 766
梦毁少年i
梦毁少年i 2021-01-16 15:29

I\'m getting a SqlException on a PreparedStatement for violating a uniqueness constraint on a table (dupe key). Essentially my table looks like thi

4条回答
  •  清酒与你
    2021-01-16 16:17

    Use

    ps.setTimestamp(new java.sql.Timestamp(System.currentTimeMillis());
    

    See this: Using setDate in PreparedStatement

提交回复
热议问题