Using setDate in PreparedStatement
❐ Using java.sql.Date If your table has a column of type DATE: java.lang.String The method java.sql.Date.valueOf(java.lang.String) received a string representing a date in the format yyyy-[m]m-[d]d. e.g.: ps.setDate(2, java.sql.Date.valueOf(“2013-09-04”)); java.util.Date Suppose you have a variable endDate of type java.util.Date, you make the conversion thus: ps.setDate(2, new java.sql.Date(endDate.getTime()); Current If you want to insert the current … Read more