Java: creating a date object from a string and inserting into MySQL

后端 未结 3 1155
花落未央
花落未央 2021-01-28 18:03

Anytime I have to handle dates/times in java it makes me sad

I\'m trying to parse a string and turn it into a date object to insert in a preparepared statement. I\'ve b

3条回答
  •  渐次进展
    2021-01-28 18:16

    PreparedStatement.setDate takes a java.sql.Date, not a java.util.Date.

    (Out of interest, how come you're not actually seeing this as a compile-time error? Your life will become a lot easier if you can resolve compilation failures without having to get to that point in a test run...)

提交回复
热议问题