安卓正在尝试将msqlite字符串日期转换为java。sql。日期
我已将日期保存到msqlite。当我检索它时,它会给我这个字符串“Fri Jul 12 13:16:33 GMT+00:00 2019”。但是,我无法将其转换为我需要的java.sql.Date
。。。
谢谢你的帮助
SQLiteDatabase db = this.getReadableDatabase();
ArrayList<GraphEntry> result = new ArrayList<GraphEntry>();
Cursor cursor = db.rawQuery("SELECT * FROM graph_table", null);
if (cursor.moveToFirst()){
do {
String date = cursor.getString(cursor.getColumnIndex("date"));
int poid = cursor.getInt(cursor.getColumnIndex("poid"));
Log.d("date before", date);
GraphEntry graphEntry = new GraphEntry(date, poid);
result.add(graphEntry);
} while(cursor.moveToNext());
}
cursor.close();
db.close();
return result;
GraphEntry graphEntry = new GraphEntry(date, poid);
告诉我
GraphEntry (java.sql.Date,int) in GraphEntry cannot be applied to (java.lang.String, int)
共 (0) 个答案