java - 试图将 msqlite 字符串日期转换为 java.sql.date
问题描述
我已将日期保存到 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 中的 GraphEntry (java.sql.Date,int) 不能应用于 (java.lang.String, int)
解决方案
推荐阅读
- r - 在设定的时间段内选择具有最早时间值的数据框行
- performance - 将镶木地板文件与 Spark 合并
- wpf - WPF Xaml Islands - UWP 地图控制像素化折线
- linux - 用映射中的值替换第一个字段
- artifactory - 在其文件夹中获取具有自定义属性的工件
- python - 如何从弹性搜索中查询数据,但只能从热门索引中查询
- typescript - 返回从使用 Typescript 传递的泛型参数推断的排序内部类型
- c++ - std::bind 和/或 std::forward 的语义
- c++ - OpenCV FAST 操作。为什么使用 FAST 而不是 FastFeatureDetector
- cockpit - 在哪里可以找到知识驾驶舱?