title: Mysql select date having mod result is equal to zero
body: <p>My Table is</p>
  
  <pre><code>id name reg_date
  1 ABC 2018-08-16
  2 PQR 2018-08-10
  3 LMN 2018-07-27
  4 AAA 2018-01-01
  5 BBB 2018-08-11
  </code></pre>
  
  <p>I want to get all user register on seven days interval before of given date. lets suppose I pass '2017-08-17'. Now I want to pass two date ('2017-08-17','2017-08-19'). so I want which date match betwwen this two date. right now mysql query is</p>
  
  <pre><code>SELECT *
  FROM myTable
  WHERE
      MOD(UNIX_TIMESTAMP(DATE('2017-08-17')) -
          UNIX_TIMESTAMP(DATE(reg_date)), 7*24*60*60) = 0
  </code></pre>
  
  <p>Result will be</p>
  
  <pre><code>id name date     match_date
  2 PQR 2018-08-10 2017-08-17
  3 LMN 2018-07-27 2017-08-17
  5 BBB 2018-08-11 2017-08-18
  </code></pre>