note 31883 deleted from function.date by philip

From: Date: Sat, 02 Aug 2003 15:32:06 +0000
Subject: note 31883 deleted from function.date by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-53208@lists.php.net to get a copy of this message
Note Submitter: tyler7@hotpop.com ---- 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 (#53208) next »