I am trying to fetch some data from my table based on Dates but It seems like it is not working. I am using activeAndroid ORM for my database.
I have Model Emp with the field "created" and I am trying to fetch some rows from it based on date. but it does not return anything while when I check the raw list of created dates Emp model has values.
I have two method when I do getEmp List I get full list, below is value of "created" in all the rows for Emp model
Created Tue May 19 18:28:01 GMT+02:00 2015
Created Tue May 19 18:28:01 GMT+02:00 2015
Created Tue May 19 18:28:01 GMT+02:00 2015
Created Tue May 19 18:28:01 GMT+02:00 2015
Method to fetch above data is
public List<Emp> getEmpList(){
return new Select().from(Emp.class).execute();
}
but when I do query respective to date I do get anything with below code
private List<Emp> getEmpOfDate(Date date){
Calendar c = Calendar.getInstance();
c.setTime(date);
Log.d(TAG, "Emp Date "+ c.getTime());
return new Select()
.from(Emp.class)
.where("created = ? ", c.getTimeInMillis())
.execute();
}
OutPut is
Emp Date Tue May 19 18:28:01 GMT+02:00 2015
size : 0
I dont understand why it is not working if Emp table has data, any hits
Aucun commentaire:
Enregistrer un commentaire