I am trying to get two dates from an SQL query and compare them. Therefore, to compare them, I believe that I will need to use the "Date" type. Here is what I am trying, I know that I am getting the date from resultSet incorrectly, but I'm not sure how to do it.
Date validDate = new Date(0); Date currentDate = new Date(0); // query if (result.next()) { validDate = (result.getObject("validDate")!=null)?result.getObject("validDate").toDate():""; currentDate = (result.getObject("currentDate")!=null)?result.getObject("currentDate").toDate():""; } if (currentDate > validDate) { //do something }
So that was my attempt, but I cannot get it to work. Thanks in advance.
EDIT: The request has TO_CHAR (column, "MM-DD-YYYY") for the two dates that I receive.
source share