note 31882 deleted from function.date by stone

From: Date: Wed, 07 May 2003 21:42:27 +0000
Subject: note 31882 deleted from function.date by stone
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-47650@lists.php.net to get a copy of this message
I found a VERY easy way to find time difference. It uses UNIX time stamps: <?php $s = $row["end"] - $row["start"]; $m = 0; while ( $s >= "60" ) { $m = $m + 1; $s = $s - 60; } $h = 0; while ( $m >= "60" ) { $h = $h + 1; $m = $m - 60; } $d = 0; while ( $h >= "24" ) { $d = $d + 1; $h = $h - 24; } $diff = ""; if ( !$d == "0" ) { $diff = $diff . "$d days "; } if ( !$h == "0" ) { $diff = $diff . "$h hours "; } if ( !$m == "0" ) { $diff = $diff . "$m minutes "; } if ( !$s == "0" ) { $diff = $diff . "$s seconds "; } if ( $diff = "" ) { $diff = "-"; } trim ($diff); ?>

« previous php.notes (#47650) next »