RESSOURCES 
 
Calculer la durée entre deux dates
Fourni par SQLI 14 février 2001
 
 

 

/**************************************************
*
* GetDuration
* Laurent Lacroix, 14/02/2001 02:24
*
* Calcul la durée écoulée entre 2 dates exprimées en millisecondes
*
* @param $start_microtime ... 
* @param $end_microtime = 0 ... 
* @return {KEY_RETURN_DESC}
*
* @see 
*
*************************************************/

Function GetDuration( $start_microtime, $end_microtime = 0 )
{
 if( $end_microtime == 0 ) $end_microtime = microtime();
 $start_micro = LeftPart( $start_microtime, " " );
 $end_micro = LeftPart( $end_microtime, " " );
 $start_microtime = RightPart( $start_microtime, " " );
 $end_microtime = RightPart( $end_microtime, " " );
 if( $end_micro <= $start_micro ) 
 {
  $end_micro += 1;
 }
 $dif_time = $end_microtime - $start_microtime;
 $dif_micro = $end_micro - $start_micro;
 $construct_time = ( $end_microtime - $start_microtime ) + 1000 * $dif_micro;
 return $construct_time;
}
 
Accueil | Haut de page