I have this code. And I need convert a string “horaTarefa HH:MM” to int “hour = HH” and int “minute = MM”
I guess can I do the same thing with “dateTarefa DD/MM/YYYY”?
SQLiteDatabase db;
db = openOrCreateDatabase("AgendadorTarefas.db",SQLiteDatabase.CREATE_IF_NECESSARY,null); { }
Cursor c = db.query("Tarefa", new String[] {
"codTarefa", "dateTarefa", "horaTarefa", "textoTarefa"},
null, null, null, null, null);
c.moveToFirst();
final ArrayList<String> result = new ArrayList<String>();
while(c.moveToNext())
{
String Date = c.getString(1);
String Hora = c.getString(2);
String Texto = c.getString(3);
result.add(Data + " às " + Hora + " \n" + Texto);
}
hour = Calendar.HOUR;
minute = Calendar.MINUTE;
c.close();
If you know the position of the hour/minute/etc and it is always the same, you can get it with
substring, and then convert it to numbers withInteger.parseInt