I first retrieve information from the SQLite database into a cursor.
The cursor contains a timestamp column in the format: yyyy-MM-dd HH:mm:ss.SSS
, for example, 2010-08-27 21:25:30.575
Once retrieved, I set aSimpleCursorAdapter
like so (code simplified):
SimpleCursorAdapter adapter =
new SimpleCursorAdapter(this, R.layout.row_layout, cursor, new String{KEY_TITLE, KEY_TIMESTAMP}, new int[]{ R.id.title, R.id.timestamp } );
setListAdapter(adapter);
The code successfully displays the time and date in the format described above, but I would like to display just the date in DD/MM/YYYY format (or perhaps the user's format based on locale if possible).
How can I intervene with the SimpleCursorAdapter to change the date to my preferred format?
N.B. I would be willing to change the way information is passed to the adapter if it simplifies matters. I also wouldn't mind changing the SQLite query for the cursor if SQLite has a built-in formatter.