Long time reader, first time poster.
On Android, fixing the date with datepicker and storing as a string in sqlite. Sorting by date does not work, because these are strings (unless I am mistaken.
I tried this problem for ~ 5 days, and there seems to be a way to grab the date from the selection date, convert it to Long, save it in sqlite as Long, select and sort by Long date value, then convert Long to the string "mm / dd / yyyy "to display. I tried various combinations of parsing expressions, Date, FormatDate, etc. No luck at all.
My actual flow of applications will be: When the activity starts, get the date today and display it in the button that calls datepicker. Record the new date with datepicker (if entered), save it as long-sqlite. When you open an activity that displays a list of records, select from sqlite with orderby in the date (Long), convert Long to the string "mm / dd / yyyy" to display in the ListView.
If someone can point me to a sample code, it would be very helpful - thanks!
Evan
source
share