You are here: strtotime() lost precision? « PHP « IT news, forums, messages
strtotime() lost precision?

Posted by Mario de Frutos Dieguez on 10/21/80 11:14

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация