this is sqlite query and need a use in cursor loader. select * from triphistory where _startdate > date('now','-8 days');
i try this but not working code given below . please check this.
c = new CursorLoader(
this,
HollaContractClass.Hollas.TRIP_HISTORY_URI,
PROJECTION,
HollaContractClass.Hollas.HollaTripHistoryColumns.STATUS
+ " =? AND "
+ HollaContractClass.Hollas.HollaTripHistoryColumns.START_DATE
+ " >?",
new String[] { "finished", "date('now','-8 days')" },
HollaContractClass.Hollas.HollaTripHistoryColumns.START_DATE
+ " asc");
but it return 0 .. thanks in advance
SQL parameters (?
) are for strings that are not to be interpreted in any way.
The values in the start date column are compared against the literal string date('now','-8 days')
.
To execute the date
function, you have to write it directly into the SQL string:
c = new CursorLoader(
...
+ HollaContractClass.Hollas.HollaTripHistoryColumns.START_DATE
+ " > date('now','-8 days')",
new String[] { "finished", },