note 14469 added to ref.datetime.php

From: Date: Wed, 01 Aug 2001 12:24:21 +0000
Subject: note 14469 added to ref.datetime.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-16163@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; } http://www.php.net/manual/fr/ref.datetime.php

« previous php.notes (#16163) next »