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... – Invertebratejava.sql.Date
at all. Please edit your post. – Invertebratejava.sql.Date
and 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... – Invertebratedatetime
column in a database, I don't understand the requirement "I want something in this format
". Format has to do with output, not data types. – Edwardedwardian