note 14469 deleted from ref.datetime.php by philip

From: Date: Wed, 01 Aug 2001 15:42:26 +0000
Subject: note 14469 deleted from ref.datetime.php by philip
Groups: php.notes 
Request: Send a blank email to php-notes+get-16168@lists.php.net to get a copy of this message
When using mysql, you may need to know the number of seconds between two dates, so when using two timestamps 12, here is a very basic function, adjust it to your needs: $between = elapsedTime($oldestTime,$NewestTime); function elapsedTime($from,$to) { $tyear = substr($from, 0, 4); $tmonth = substr($from, 4, 2); $tday = substr($from, 6, 2); $thour = substr($from, 8, 2); $tminute = substr($from, 10, 2); $tsecond = substr($from, 12, 2); $from = mktime($thour, $tminute, $tsecond, $tmonth, $tday, $tyear); $tyear = substr($to, 0, 4); $tmonth = substr($to, 4, 2); $tday = substr($to, 6, 2); $thour = substr($to, 8, 2); $tminute = substr($to, 10, 2); $tsecond = substr($to, 12, 2); $to = mktime($thour, $tminute, $tsecond, $tmonth, $tday, $tyear); $temp = $to-$from; return $temp; }

« previous php.notes (#16168) next »