Reputation:
I am implementing a functionality I am storing date in String form and get current date in string from using LocalDate function so I want to compare both dates, I want to fetched only current date records.
No error found but record could not fetch.
public ArrayList<Followup_Model> followup_reminder (ArrayList<Followup_Model> followup_Model_list) {
if (followup_Model_list == null) {
followup_Model_list = new ArrayList<>();
}
SQLiteDatabase sqLiteDatabase = this.getReadableDatabase();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd");
LocalDate localDate = LocalDate.now();
String Today = dtf.format(localDate);
Cursor followup_output = sqLiteDatabase.rawQuery("SELECT * FROM " + Table_Name_Followup +
" WHERE CREATEDBY = '1' AND CHECKED = '1' AND STARTDATE = " + Today +
" ORDER BY REMINDER ASC",null);
Upvotes: 1
Views: 604
Reputation: 1008
Just copy and Paste.
public ArrayList<Followup_Model> followup_reminder (ArrayList<Followup_Model>
followup_Model_list) {
if (followup_Model_list == null) {
followup_Model_list = new ArrayList<>();
}
SQLiteDatabase sqLiteDatabase = this.getReadableDatabase();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd");
LocalDate localDate = LocalDate.now();
String Today = dtf.format(localDate);
Cursor followup_output = sqLiteDatabase.rawQuery("SELECT * FROM " + Table_Name_Followup +
" WHERE CREATEDBY = '1' AND CHECKED = '1' AND STARTDATE = '" + Today + "'" +
" ORDER BY REMINDER ASC",null);
Upvotes: 1