title: Query last day, last week, last month SQLite
body: <p>I have this table in my Android SQLite DB:</p>
  
  <pre><code>CREATE TABLE statistics (subject TEXT, hits INTEGER, fails INTEGER, date DATE)
  </code></pre>
  
  <p>On <code>date</code> field is stored <code>datetime('now', 'localtime')</code> in every register.</p>
  
  <p>Now I must query last day, last week and last month registers for showing some statistics.
  I've been trying something like this </p>
  
  <pre><code>    SELECT Timestamp, datetime('now', '-1 week') FROM statistics WHERE TimeStamp &lt; datetime('now', '-1 week') 
  </code></pre>
  
  <p>and this </p>
  
  <pre><code>    SELECT * FROM statistics WHERE date BETWEEN datetime('now', localtime') AND datetime ( 'now', '-1 month')
  </code></pre>
  
  <p>and doesn't work :(</p>
  
  <p>How can I do it?</p>
  
  <p>Can I check if the query is OK by simply forwarding date in the virtual device emulator?</p>
  
  <p>Thanks!</p>