Reputation: 13
I have a cursor that fetches some data from my SQLite database via a Content Provider.
I want to sort the rows according to date, which I tried by using:
FeedTables.PostTable.COLUMN_PUBLISHED + " ASC"
Problem is, this only sorts it by day, not the date. So a "newer" row might be last, while a "old" row is at the top.
Example of a date in the database:
Fri, 16 Oct 2015 19:38:20 +0100
The COLUMN_PUBLISHED is of the type Date Time
Upvotes: 0
Views: 179
Reputation: 8558
If you can control the format of your date in sqlite database, you should save it in long time,like what System.currentTimeMillis()
get,it's more effective and reasonable.
If you can't,then you should define a algorithm to compare your date of that format.
Upvotes: 2