I have table which contains data along with created on date. I want to select data from table according to two given date ranges, or of one particular month.
I am not sure how to do that, as created on column is of type text and is stored as dd-MM-yyyy HH:mm:ss
I am using rawQuery() to fetch data.
You can do something like this:
mDb.query(MY_TABLE, null, DATE_COL + " BETWEEN ? AND ?", new String[] {
minDate + " 00:00:00", maxDate + " 23:59:59" }, null, null, null, null);
minDate
and maxDate
, which are date strings, make up your range. This query will get all rows from MY_TABLE
which fall between this range.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With