title: What can use for DateTime::diff() for PHP 5.2?
body: <p>Is there any function equivalent to DateTime::diff() in PHP 5.2?</p>
  
  <p>My local server is PHP 5.3 and using DateTime::diff(). then I found that my live site uses PHP 5.2 and gives an error.</p>
  
  <pre><code>Fatal error: Call to undefined method DateTime::diff() in /var/www/some/other/dir/web/daikon/modules/projects/views/admin/log/admin_log_list.php on line 40
  </code></pre>
  
  <p>The PHP code:</p>
  
  <pre><code> foreach ($logs as $key =&gt; $list){
   ...
   // show date in European way dd-mm-yyyy not in MySQL way yyyy-mm-dd
      $newdate =new DateTime($list['date']) ;
      echo "&lt;td class=\"left\" width=\"8%\"&gt;".$newdate-&gt;format('d-m-Y')."&lt;/td&gt;\n";
      $starttime = new DateTime($list['start_time']);
      echo "&lt;td width=\"7%\"&gt;".date_format($starttime, 'H:i')."&lt;/td&gt;\n";
      $finishtime = new DateTime($list['finish_time']);
      echo "&lt;td width=\"8%\"&gt;".date_format($finishtime, 'H:i')."&lt;/td&gt;\n";
      $timediff = 0;
      $interval = $starttime-&gt;diff($finishtime);
      $hours   = $interval-&gt;format('%h');
      $minutes = $interval-&gt;format('%i');
      $timediff = $hours * 60 + $minutes;
  </code></pre>