我以我的數據庫格式「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);
}
請發佈顯示您的查詢的代碼。 – CommonsWare 2012-08-11 21:10:02
更新了代碼 – tyczj 2012-08-11 21:11:10