Logic in comparing 2 dates in php
<p>I just want to ask, i have 3 dates, the date today, the date_of_needed and the other date which is 2 weeks ahead, i have this code:</p>

<pre><code>$DateNeeded = $this-&gt;input-&gt;post('date_of_need');
$newDate = date("m-d-y",strtotime("+2 weeks"));
$d = $this-&gt;input-&gt;post('dateavail');
</code></pre>

<p>When I echo those 3 dates i come up with this:</p>

<pre><code>Date Needed: 9/12/16
Date to be Reserved: 9/24/16
Date Today: 9/10/16
</code></pre>

<p>I want to have a logic that will make me unavailable to reserve a products if it is less than 2 weeks. How will i do that?
Here is my logic</p>

<pre><code>if($DateNeeded &lt; $newDate){
   echo "You need to reserve 2 weeks ahead!";
}
</code></pre>

<p>But it isnt working.. Thank you for helping me</p>