How do I get the current date with the format of yyyy-MM-dd
and save it in database with Date
value? I have this code but it does not work...
Java:
Calendar cal = Calendar.getInstance();
java.util.Date d = new java.util.Date();
d.setMonth(cal.get(Calendar.MONTH));
d.setDate(cal.get(Calendar.DATE)-1900);
d.setYear(cal.get(Calendar.YEAR));
Here is my PreparedStatement:
pstmt.setDate(6, (Date)d);