title: MySQL query to get data in WordPress Php base on numbers of exact days from Current
body: <p>i want to get the ID from the post table where the post_modified date is exactly 5day ago. and foreach ID i get i will do another call another function. i know i have to add a loop somewhere but mybrains hurts when it comes to looping please help!</p>
  
  <p>i have 3 example records to compare date.</p>
  
  <pre><code>{
  status: "ok",
  post: [
  {
  ID: "99",
  post_modified: "2015-09-02 07:58:14"
  },
  {
  ID: "100",
  post_modified: "2015-09-04 02:59:27"
  },
  {
  ID: "101",
  post_modified: "2015-09-09 07:36:56"
  }
  ]
  }
  </code></pre>
  
  <p>this is myfunction code</p>
  
  <pre><code>public function test(){
              global $wpdb;
              $data= $wpdb-&gt;get_results("SELECT ID FROM $wpdb-&gt;posts WHERE post_status like 'wc-completed' AND post_modified &lt; DATE_SUB(now(), INTERVAL 5 DAY)");
  
              return $data;
  
          }
  </code></pre>