Cursor allDetail = allDatabase2.rawQuery("Select "+ TaskDatabaseManager.KEY_ROWID + ","+ TaskDatabaseManager.TASK_TIMES + ","+ TaskDatabaseManager.TASK_DESCRIPTION + " from "+ TaskDatabaseManager.DATABASE_TABLE + " where "+ TaskDatabaseManager.TASK_DATE + "= '" + LaunchActivity.selectedDate + "'", null);
I am not able to correctly compare the two date's in the database. Any help regarding how to compare them.My Android Database Schema is
static final String CREATE_QUERY = "CREATE TABLE " + DATABASE_TABLE + "("+KEY_ROWID+" INTEGER PRIMARY KEY AUTOINCREMENT ,"
+ TASK_DESCRIPTION + " VARCHAR(200) NULL,"+TASK_DATE+ " DATE Null, "+ TASK_TIMES
+ " VARCHAR(30) NULL," + TASK_STATUS + " BOOLEAN DEFAULT FALSE);";
I found this on a Google Forum:
SQLite treats dates as strings. If you don't store your date/times
using ISO-8601 format (YYYY-MM-DD HH:MM:SS), you can't compare them,
since only in ISO-8601 format do lexical comparisons work as expected.