3 +-------------------------------------------------------------------------+
4 | Copyright 2010-2011, Davide Franco |
6 | This program is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU General Public License |
8 | as published by the Free Software Foundation; either version 2 |
9 | of the License, or (at your option) any later version. |
11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. |
15 +-------------------------------------------------------------------------+
19 static public function Get_Elapsed_Time( $start_time, $end_time)
24 if( $start_time == '0000-00-00 00:00:00' )
27 $start = strtotime( $start_time );
29 if( $end_time == '0000-00-00 00:00:00' )
32 $end = strtotime( $end_time );
34 $diff = $end - $start;
36 $daysDiff = sprintf("%02d", floor($diff/60/60/24) );
37 $diff -= $daysDiff*60*60*24;
39 $hrsDiff = sprintf("%02d", floor($diff/60/60) );
40 $diff -= $hrsDiff*60*60;
42 $minsDiff = sprintf("%02d", floor($diff/60) );
43 $diff -= $minsDiff*60;
44 $secsDiff = sprintf("%02d", $diff );
47 return $daysDiff . 'day(s) ' . $hrsDiff.':' . $minsDiff . ':' . $secsDiff;
49 return $hrsDiff . ':' . $minsDiff . ':' . $secsDiff;