title: how to use curdate() in where clause against unixtimestamp (bigint) column
body: <p>I am trying to pull records in the past 7 days. This is my select statement that I have been trying to get to work:</p>
  
  <pre><code>select from_unixtime(time,'%m/%d/%y') as fdate, from_unixtime(time,'%h:%m:%s') as ftime
  from mdl_log
  where from_unixtime(time,'%y-%m-%d')  between curdate() and curdate() - INTERVAL 7 DAY
  </code></pre>
  
  <p>I have tried various incarnations of the where clause like</p>
  
  <pre><code>where time between curdate() and curdate() - INTERVAL 7 DAY
  </code></pre>
  
  <p>and</p>
  
  <pre><code>where from_unixtime(time,'%yyyy-%mm-%dd')  between curdate() and curdate() - INTERVAL 7 DAY
  </code></pre>
  
  <p>and</p>
  
  <pre><code>where date(time) between curdate() and curdate() - INTERVAL 7 DAY
  </code></pre>
  
  <p>select curdate() - results in the date showing in this format 2012-11-08</p>