difference between two date and display it in input by using php
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/676824/how-to-calculate-the-difference-between-two-dates-using-php">How to calculate the difference between two dates using PHP?</a>  </p>
</blockquote>



<p>I have three input in html. two of them are start date and end date and the third one is to find the difference between them and display the result .</p>

<p>here is the inputs:</p>

<pre><code>&lt;p&gt;&lt;span&gt;Start date:&lt;/span&gt; &lt;input type="date" required min="2012-01-01" name="start_d" id="start_d" &gt;&lt;span&gt;* Format: YYYY-MM-DD&lt;/span&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;End date:&lt;/span&gt; &lt;input type="date" required min="2012-01-01" name="end_d" id="end_d" &gt;&lt;span&gt;* Format: YYYY-MM-DD&lt;/span&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Duration :&lt;/span&gt;&lt;input type="text" required name="duration" id=duration" readonly="readonly"&gt;&lt;br&gt;&lt;/p&gt;
</code></pre>
