I am trying to set up a method to convert java.util.date typed variables into java.sql.date typed variables so they can be persisted to database. However, the code I set up keeps returning a null pointer exception, even though I am getting values on the argument being passed into the method.
public static java.sql.Date convertUtilDateSQLDate(java.util.Date utilDate){
long utilDateTime = utilDate.getTime();
java.sql.Date sqlDate = new java.sql.Date(utilDateTime);
return sqlDate;
}
Does anyone know why this might be happening?