title: How to calculate duration of two different of two date in codeigniter?
body: <p>I prefer to calculate date time in Codeigniter as below description </p>
  
  <p>I select date from database with two different duration </p>
  
  <ol>
  <li>From_date = 2014-11-30,</li>
  <li>To_date   = 2014-12-03,</li>
  </ol>
  
  <p>I want to get result as below.</p>
  
  <p>duration = <strong>from_date</strong>-<strong>To_date</strong> </p>
  
  <p><strong>duration = ?</strong></p>
  
  <pre><code>&lt;?php 
      $exp = date("y-m-d",strtotime($invoice-&gt;fto));
      $now = date("y-m-d",time());
      $diffday = $now-$exp;
      echo $diffday;
  ?&gt;
  </code></pre>
  
  <p>As above code I get only <strong>0</strong></p>