with a query, I get a value of "date" from the SQLite database, in the format "YYYY-MM-DD". Now I want to convert this format to display the date in the format getInstance (). How can I do?
DateFormat fmtDateAndTime=DateFormat.getDateInstance();
GregorianCalendar dateAndTime = (GregorianCalendar) GregorianCalendar.getInstance();
I get the date:
private void Mto() {
String id_ricevuto = (i.getStringExtra("id_p"));
SQLiteDatabase db = mHelper.getReadableDatabase();
String tabella = "SELECT _id, date FROM Table1 WHERE _id = '"+id_ricevuto+"'";
Cursor c = db.rawQuery(tabella, null);
while (c.moveToNext()){
String id = c.getString(0);
String date = c.getString(1);
//here I want to convert the data before displaying it in the TextView
idw.setText(id);
mBtnPickDate.setText(date);
}
c.close();
db.close();
}