Created
November 3, 2014 14:13
-
-
Save dave-jay/0186c38061b1e04a50c7 to your computer and use it in GitHub Desktop.
Revisions
-
dave-jay created this gist
Nov 3, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ <?php function _dateDiff($date1, $date2) { $time = strtotime($date1); $time2 = strtotime($date2); $diff = $time - $time2; $return = array(); $days = $diff / (60 * 60 * 24 ); $whole = floor($days); $hours = intval(($days - $whole)*24); $return['days'] = intval($days); $return['hours'] = $hours; return $return;; } _dateDiff("2014-11-05 11:00:00", "2014-11-01 13:00:00")); # returns: /* ...Array ( [days] => 3 [hours] => 23 ) */ ?>