我以我的数据库格式“MM/dd/yyyy”存储日期,我想按特定日期进行查询,但是当我进行查询时,光标什么也不返回。
是因为字符串中的“/”还是其他原因?是的,我知道日期已正确存储在数据库中
@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
return new CursorLoader(getActivity(),Games.GAMES_URI,new String[] {Games.GAMES_ID},Games.GAMES_DATE + "="+dt,
null,null);
}
转换日期
public convertDate(Calendar date){
mDate = date;
Date d = new Date(date.getTimeInMillis());
DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
dt = df.format(d);
}