title: Android - datetime field hell! - well, seems like it anyway! :)
body: <p>I am storing values from Calendar.getTime() in my SQLite database field called 'Created' when new records are inserted..</p>
  
  <p>The field is 'datetime' and it stores values in this format : EEE MMM dd HH:mm:ss z yyyy.</p>
  
  <p>My app has 2 datepickers so you can select a start and end date/time to create a range - all I need to do is run a query to return records which were created within this timespan but it is giving me a major headache!</p>
  
  <p>My query looks like this :</p>
  
  <pre><code>public Cursor GetAllByDateRange(Date dtStart, Date dtEnd) {
  
      return database.query(DATABASE_TABLE, new String[] { 
              KEY_id, KEY_CREATED, KEY_VALUE, KEY_DESCRIPTION, KEY_ISEXPENSE}, 
              KEY_CREATED + " BETWEEN '" + dtStart + "' AND '" + dtEnd + "'",
              null, null, null, KEY_CREATED + " DESC");
  }
  </code></pre>
  
  <p>I think I understand the problem but not how to resolve it, I believe this approach will not work because SQLite stores dates in String format (if this is true I'm not sure why they even have a Date' type!), so they get compared as Strings rather than dates..</p>
  
  <p>It appears my options are limited because I need to record time as well as the date, having spent most of today trawling the web I am at a complete loss - can anyone suggest how I can move forward?</p>
  
  <p>Thanks!</p>