0
在Android中,我使用SqlLite
与MyDate
行像DATETIME DEFAULT CURRENT_TIMESTAMP
。但是当我读日期时,我得到一个小时的日期,因为我在我的android环境中使用了GMT + 1
。从SqlLite Android的日期取决于GMT
MyDate: 12:03
Android date: 13:03
从SqlLite
读取时我如何才能将其转换为GMT + X
,取决于Android的环境?
编辑:
代码:
Cursor cursor = logsDao.getAll(LogsDao.KEY_ID + " DESC", "100");
String[] columns = new String[] { LogsDao.KEY_CONTENT, LogsDao.KEY_COMMENT, LogsDao.KEY_CREATED };
int[] to = new int[] { R.id.logContext, R.id.logComment, R.id.logCreated };
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this,
R.layout.log_entry, cursor, columns, to);
setListAdapter(mAdapter);
谢谢。我更新我的问题,因为我不知道如何在SimpleCursorAdapter – senzacionale 2013-02-11 13:23:11
中使用此代码,您需要实现自定义cursorAdapter http://thinkandroid.wordpress.com/2010/01/11/custom-cursoradapters/ – StarsSky 2013-02-11 13:34:06