strtotime() lost precision?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

I'm back hahaha :D

I'm making functions to calculate the duration (only laboral days) between 2 dates and the initial and final date between a duration give me in laboral days.

I use the following function to make the diference between 2 dates:

function fecDiferenciaFechas($fecFechaInicio,$fecFechaFin)
{
$fecFechaInicio=strtotime($fecFechaInicio);
$fecFechaFin=strtotime($fecFechaFin);
if ($fecFechaFin == -1 || $fecFechaInicio == -1)
{
return false;
}
$iDiferencia = $fecFechaFin - $fecFechaInicio;
//Inicializamos la variable
$iDias = 0;
//Devolvemos la diferencia en dias
return ($iDiferencia/86400);
}


The problem is that with a duration of 220 the return is 219.958333, where im losing precision?

(Sorry for my home english :P)

--
Mario de Frutos Dieguez

División de Ingeniería del Software
y Comunicaciones


CARTIF -Parque Tecnológico Boecillo

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux