This article describes the method of implementing oracle inserting the current time in Java. Share it for your reference. The specific analysis is as follows:
When I do an insert operation, I need to get the current time and store it in the database.
ps.setDate(new java.util.Date());
But there will be a conversion error
It should be
java.util.Date utilDate = new java.util.Date();java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());ps.setDate(sqlDate);
That's it
I hope this article will be helpful to everyone's Java programming.