Fan*_*ini 0 java time android date activeandroid
我是Android开发人员的新手,所以我使用ActiveAndroid来管理数据库,我在使用带有Date变量的查询时遇到了麻烦,我有:
From fromQuery = new Select().from(Shift.class);
//It doesn't matter what currentShiftDates do.
CurrentShiftDates currentShiftDates = new CurrentShiftDates();
fromQuery = fromQuery.where("startDate > ? and startDate < ?",currentShiftDates.startDate,
currentShiftDates.endDate);
return fromQuery.execute();
Run Code Online (Sandbox Code Playgroud)
我已经读过查询需要将参数作为long值传递,所以我尝试使用.getTime():
fromQuery = fromQuery.where("startDate > ? and startDate < ?",currentShiftDates.startDate.getTime(), currentShiftDates.endDate.getTime());
Run Code Online (Sandbox Code Playgroud)
但它仍然无效.
我做错了什么?
我很抱歉,它没有用,因为我正在编写"startDate",列名是"StartDate",所以正确的查询是:
fromQuery = fromQuery.where("StartDate > ? and StartDate < ?",currentShiftDates.startDate.getTime(), currentShiftDates.endDate.getTime());
Run Code Online (Sandbox Code Playgroud)