How to convert Calendar to java.sql.Date in Java?

There is a getTime() method (unsure why it's not called getDate).

Edit: Just realized you need a java.sql.Date. One of the answers which use cal.getTimeInMillis() is what you need.


Use stmt.setDate(1, new java.sql.Date(cal.getTimeInMillis()))


Did you try cal.getTime()? This gets the date representation.

You might also want to look at the javadoc.