I am trying to modify the NotePad sample code from the Android developer resources. The date is stored in a SQLi开发者_如何学运维te database as a Long and retrieved using the SimpleCursorAdapter.
http://developer.android.com/resources/samples/NotePad/index.html
When I call the MODIFIED_DATE with the Notes ListView, it returns as an milliseconds/Unix format. (Below) Ideally I would like to show "12-15-2010".
Any suggestions would be appreciated. I have tried a bunch of things (e.g. creating a new column in the database) and ended up with a lot of Force Closes.
Thank you.
To convert a date/time represented as milliseconds to a human readable one, you need to look at the android.text.format.DateFormat class and, in particular, this method...
CharSequence format(CharSequence inFormat, long inTimeInMillis)
The Class Overview gives examples of formatting characters.
精彩评论