I use SQLite as a data store for my Android application. I created one table with a datetime column. When I insert notes or select sentences, I use the dd.MM.yyyy format (08/10/2012) for dates.
Now I have a problem getting the line with the last date / MAX. I tried using the MAX statement (date_column), but it returns an invalid date. I have the following dates in my desk, and it returns on July 31, 2012 instead of August 4, 2012. Does anyone know what I'm doing wrong?
04.08.2012 03.08.2012 02.08.2012 01.08.2012 31.07.2012 30.07.2012
Here is the piece of code:
String selection = "measurementDate = (SELECT MAX(measurementDate) FROM Measurements)"; Cursor cursor = database.query("Measurements", allColumns, selection, null, null, null, null); cursor.moveToFirst(); ...
source share