I am trying to insert java.util.Date after converting it to java.sql.Timestamp and I am using the following snippet:
java.util.Date utilDate = new java.util.Date();
java.sql.Timestamp sq = new java.sql.Timestamp(utilDate.getTime());
But this is giving me sq as 2014-04-04 13:30:17.533
Is there any way to get the output without milliseconds?
java.sql.Timestamp- did you want that, or ajava.sql.Date? They're different types...java.sql.Dateat all. Please edit your post.java.sql.Dateand then usesjava.sql.Timestamp. I'm well aware of both types, but they're not the same, and we weren't given actual requirements... with the comment a couple of minutes ago, it's clearer - but that information had to come from the OP...