3
I am having difficulty in making the process of setting the current date of my Sqlite database in the type attribute java.util.Date
of my object.
The Sqlite date comes in "yyyy-MM-dd" format. I am trying to convert to the accepted format in type java.util.Date
and allow me to use it in my Adapter but when running the application is returning me an error saying that the date is null. Really when debugged the App saw that the date is not being set.
Follow the code part.
Date data = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
String dataTeste = cursor.getString(1);
try {
data = dateFormat.parse(dataTeste);
} catch (ParseException e) {
e.printStackTrace();
}
v.setDataVenda(data);
Note: In the variable dataTeste
the value being filled in is "2015-11-15".