I have this code:
String dt = "2017-01-04";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
sdf.parse(dt);
} catch (ParseException e) {
e.printStackTrace();
}
But when I use dt, in a method that requires java.util.date, it says no dt is not correct because it is a string.