I basically made a listview with Alphabet-Indexed section headers by following this tutorial. I’m trying to make the same, sorted with dates.
This is how my date column in database is fed with.
String currentDateTime = DateFormat.getDateTimeInstance().format(new Date());
Can some one help me with pointers or snippets on sort by date.?
The only way I know is using
java.util.Date. It’s almost nothing more than a wrapper around a long value corresponding to difference between the time it represents, and the epoch,Jan 1, 1970 00:00:00 GMT. So you can store in the DB longs (instead of strings), and then when querying the table sort the results by the “date” (longs), constructing dates out of those values. All this because sqlite doesn’t support date formats.somethign like this: