Why is this date_diff not working?
<p>I want to display a 'NEW' div when an image has a 'date created' value set in a database, that is no more than a week old.</p>

<pre><code>$now = new DateTime();
$then = new DateTime($imageSet-&gt;created);
$diff = date_diff($now,$then);
if($diff-&gt;format('%d') &gt;= 0 &amp;&amp; $diff-&gt;format('%d') &lt; 8 &amp;&amp; $imageSet-&gt;created != null) { $new = 1; } else { $new = 0; }
</code></pre>

<p>But with an image that has a date created value of 2016-05-17, this is showing the div 'NEW', when it's obviously much more than a week old. Based on my condition above, I'm expecting any date created value of 2016-07-12 or later to trigger the 'NEW' div.</p>

<p>Any ideas why it's not?</p>