Gettting the time difference between to given dates/time

function timeDiff($firstTime,$lastTime)
  1. {
  2.  
  3. // convert to unix timestamps
  4. $firstTime=strtotime($firstTime);
  5. $lastTime=strtotime($lastTime);
  6.  
  7. // perform subtraction to get the difference (in seconds) between times
  8. $timeDiff=$lastTime-$firstTime;
  9.  
  10. // return the difference
  11. return $timeDiff;
  12. }
  13.  
  14. //Usage :
  15. echo timeDiff("10-01-02 19:00:00","10-01-03 18:56:32");