note 38842 deleted from ref.datetime by nlopess

From: Date: Thu, 08 Jan 2004 16:07:42 +0000
Subject: note 38842 deleted from ref.datetime by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-63150@lists.php.net to get a copy of this message
Note Submitter: hugo@feapa.com.br ---- function GetDiffYear($dia_start, $mes_start, $ano_start, $dia_end, $mes_end, $ano_end) { if ($mes_end >= $mes_start) { if ($mes_start == $mes_end) { if ($dia_end >= $dia_start) { return $ano_end - $ano_start; } else { return $ano_end - ($ano_start +1); } } else { return $ano_end - $ano_start; } } else { return $ano_end - ($ano_start +1); } } function GetDiffMonth($dia_start, $mes_start, $ano_start, $dia_end, $mes_end, $ano_end) { $meses = ( ((($ano_end - 1) * 12) + $mes_end) - ((($ano_start - 1) * 12) + $mes_start) ); if ($dia_end < $dia_start) { $meses--; } return $meses; } function GetDiffDay($dia_start, $mes_start, $ano_start, $dia_end, $mes_end, $ano_end) { $DateStart = getdate(mktime(0, 0, 0, $mes_start, $dia_start, $ano_start)); $DateEnd = getdate(mktime(0, 0, 0, $mes_end, $dia_end, $ano_end)); return (($DateEnd["year"]*365 + $DateEnd["yday"]) - ($DateStart["year"]*365 + $DateStart["yday"])); }

« previous php.notes (#63150) next »