Get the current date in java.sql.Date format
Simply in one line:
java.sql.Date date = new java.sql.Date(Calendar.getInstance().getTime().getTime());
A java.util.Date
is not a java.sql.Date
. It's the other way around. A java.sql.Date
is a java.util.Date
.
You'll need to convert it to a java.sql.Date
by using the constructor that takes a long
that a java.util.Date
can supply.
java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());