// Hours Mins and Seconds difference between two dates. function timeDifference($date1=null, $date2=null) { $date1 = !empty($date1) ? $date1 : date('Y-m-d H:i:s'); $date2 = !empty($date2) ? $date2 : date('Y-m-d H:i:s'); $dateDiff = abs(strtotime($date1) - strtotime($date2)); $fullHours = floor($dateDiff / (60*60) ); $fullMinutes = floor(($dateDiff-($fullHours*60*60))/60); $fullSeconds = ($dateDiff-($fullHours*60*60)-($fullMinutes*60)); return ('T-'.$fullHours.':'.$fullMinutes.':'.$fullSeconds); }
Wednesday, 6 June 2012
Hours Mins and Seconds difference between two dates.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Please post any queries and comments here.