I am using the following code in Android to get current date time
Date currentDateTime = new Date();
And storing it in the sqlite table as
currentDateTime.ToString()
SO in the table the values are stored like so
"Tue Sep 11 20:32:39 IST 2012"
"Thu Sep 13 17:23:38 IST 2012"
"Thu Sep 13 17:34:38 IST 2012"
"Thu Sep 13 20:21:58 IST 2012"
Now I need to sort them in sqlite in desc order i.e.
select datetime(datecolumn) from table order by datetime(datecolumn) desc;
But when I do datetime(column) on the field it shows me null for all the rows on the date field
Obviously there is a data mismatch on the sqlite side. But I am not sure how to fix it – Is there a way I can still change the query on the sqlite side to be able to read this? Or do I have to change the JAVA code and insert the data in a sqlite readable format.
I need the times also since I am dealing with hourly data.
I would use
and store that value – less space needed in the database, and I assume much quicker to sort for sqlite