strtotime() lost precision?
| From: | Mario de Frutos Dieguez | Date: | Tue, 26 Apr 2005 11:03:00 +0000 |
| Subject: | strtotime() lost precision? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-213897@lists.php.net to get a copy of this message | ||
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