title: Getting the MAX date in SQLite
body: <p>Im using SQLite as data storage for my Android App. I have created one table with column of type datetime. When I do the insert of records or selects statements I use the format dd.MM.yyyy (10.08.2012) for dates.</p>
  
  <p>Now, I have issue with getting the row with the latest / MAX date. I have tried using the MAX(date_column) statement, but it returns wrong date back. I have following dates in my table and it returns 31.07.2012 in stead of 04.08.2012. Anyone know what I'm doing wrong?</p>
  
  <pre><code>04.08.2012
  03.08.2012
  02.08.2012
  01.08.2012
  31.07.2012
  30.07.2012
  </code></pre>
  
  <p>Here is part of the code:</p>
  
  <pre><code>String selection = "measurementDate = (SELECT MAX(measurementDate) FROM Measurements)";
  Cursor cursor = database.query("Measurements", allColumns, selection, null, null, null, null);
  cursor.moveToFirst();
  ...
  </code></pre>