fork download
  1. <?php
  2.  
  3. $dateTime1 = new DateTime("2015-07-14");
  4. $dateTime2 = new DateTime("2015-01-01");
  5.  
  6. $interval = $dateTime2->diff($dateTime1);
  7.  
  8. var_dump($interval->format("%R%a days"));
  9.  
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
string(9) "+194 days"