Use the .rawQuery function to use a SQL statement to retrieve data into cursor.
public Cursor fetchAllDineoutHistoryFormatDate(){ String sSelect = "SELECT " + K_ROWID + ", " + K_TITLE + ", " + K_DATE + ", " + "strftime('%" + "H:%M:%S'," + K_TIME + ", 'localtime') as " + K_TIME + ", " + K_MEAL + ", " + K_TOTAL + " FROM " + DATABASE_TABLE + " ORDER BY " + K_DATE + " desc, " + K_TIME + " desc"; return mDb.rawQuery(sSelect, null); } |