title: Deleting records more than 7 days MySQLite android
body: <p>I have been trying for days to delete records older than 7 days in MySQLite android without success. I have tried:</p>
  
  <pre><code>database.execSQL("delete from " + MySQLite.WORKFLOW_TABLE_NAME + " where '" + MySQLite.WORKFLOW_COLUMN_DATECREATED +
      "' &lt; 'DATE_SUB(NOW(), INTERVAL 7 DAY)'");
  </code></pre>
  
  <p>and</p>
  
  <pre><code>database.delete(MySQLite.WORKFLOW_TABLE_NAME, "date('now') &gt; date('" + MySQLite.WORKFLOW_COLUMN_DATECREATED + "', '+7 days')",
    null);
  </code></pre>
  
  <p>and </p>
  
  <pre><code>database.delete(MySQLite.WORKFLOW_TABLE_NAME, MySQLite.WORKFLOW_COLUMN_DATECREATED + " &lt; '"
      + dateFormat.format(range.getTime()) + "'", null);
  </code></pre>
  
  <p>and non of these is working. I am saving the date into the table using:</p>
  
  <pre><code>SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
  ContentValues values = new ContentValues();
  values.put(MySQLite.WORKFLOW_COLUMN_DATECREATED, dateFormat.format(convertStringToDate(Data.State.tripdate)));
  </code></pre>
  
  <p>The date column of the Table is created as:
      WORKFLOW_COLUMN_DATECREATED + " text not null, "</p>
  
  <p>and converting the String into a Date with:</p>
  
  <pre><code>public Date convertStringToDate(String dateString)
  {
  SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
  Date date = null;
  try {
  
    date = formatter.parse(dateString);
    System.out.println(date);
    System.out.println(formatter.format(date));
  
  } catch (ParseException e) {
    e.printStackTrace();
  }
  return date;
  </code></pre>
  
  <p>}</p>
  
  <p>Somebody helppp.</p>