title: Calculate remaining days
body: <p>I have a schoolproject where I have to make an agenda. I'm having problems with my calculation function. So the function below needs to calculate the remaining days untill my next appointment. I have a future date($timefromdb) stored in my mysql database and I want to calculate the difference between the current date and the date from my database.  </p>
  
  <pre><code>    public function getAllAfspraken(){
      $db = new Db();
      $sql = "SELECT * FROM `tblafspraken`";
      $return = $db-&gt;conn-&gt;query($sql);
  
          while($row = mysqli_fetch_array($return))
          {
          $currentdate= date("Y-m-d"); 
          $timefromdb = $row['af_datum'];
          $timeleft = $currentdate-$timefromdb;
          $daysleft = round((($timeleft/24)/60)/60); 
          echo "&lt;h3&gt;".$row['af_datum']."&lt;/h3&gt;";   
          echo "&lt;p&gt;" .$row['af_beschrijving']. "&lt;/p&gt;";
          echo $daysleft;
          echo "&lt;hr /&gt;";
          }
      }
  </code></pre>