I am using this code-
myDB.rawQuery("SELECT * FROM " + TableName+ " ORDER BY "+ params[0], null);
to sort a table by columns and it works great except one of the columns is time (like in itunes) i.e. 2:35 for 2 minutes 35 seconds. This causes it to sort incorrectly. How can I sort it the proper way? I am using sqlite for android.
Instead of storing the date as 2:35, you can have the column store seconds, and would thus be 155 (2 minutes, 35 seconds = 155 seconds). Thus it would sort it fine. You could translate seconds to minutes/seconds in the code.
Or, if you wanted to, you could have two columns, minutes and seconds.
It does not make sense to store time in a format like 2:35 if you are manipulating the data.