title: From the timestamp in SQL, selecting records from today, yesterday, this week, this month and between two dates php mysql
body: <p>Hopefully, it's an easy solution, but I am trying to filter the data for the following:-</p>
  
  <ul>
  <li>Today</li>
  <li>Yesterday</li>
  <li>This Week</li>
  <li>This Month</li>
  <li>In between two dates.</li>
  </ul>
  
  <p>The date I get from the database is basically a timestamp.</p>
  
  <p>This is what I tried:-</p>
  
  <ul>
  <li><p>Today</p>
  
  <pre><code>SELECT n.title, COUNT(*) AS times FROM node_view_count WHERE timestamp &gt; DATE_SUB(NOW(), INTERVAL 1 DAY)
  </code></pre></li>
  <li><p>Yesterday</p>
  
  <pre><code>SELECT n.title, COUNT(*) AS times FROM node_view_count WHERE timestamp &gt; DATE_SUB(NOW(), INTERVAL 7 DAYS)
  </code></pre></li>
  </ul>
  
  <p>...</p>
  
  <p>It's not really working.</p>
  
  <p>Any idea?</p>