title: Get a DateTime for one week ago
body: <p>I want to get the DateTime of one week ago to use it in a query. So I've done:</p>
  
  <pre><code>$date = new DateTime();
  $date-&gt;sub(new DateInterval('P7D'));
  $date = $date-&gt;format('Y-m-d H:i:s');
  </code></pre>
  
  <p>But for some reason this is not working right. Any idea of what I'm doing wrong?</p>