Parceiros Wgets downloads
Function idade(data:tdatetime):integer; Var AuxIdade, Meses, IdadeReal : String; MesesFloat : Real; IdadeInc : Integer; begin AuxIdade := Format('%0.2f', [(Date - data) / 365.6]); Meses := FloatToStr(Frac(StrToFloat(AuxIdade))); if AuxIdade = '0' then begin Idade := '0,0'; Exit; end; if Meses[1] = '-' then Meses := FloatToStr(StrToFloat(Meses) * -1); Delete(Meses, 1, 2); if Length(Meses) = 1 then Meses := Meses + '0'; if (Meses <> '0') And (Meses <> '') then MesesFloat := Round(((365.6 * StrToInt(Meses)) / 100) / 30) else MesesFloat := 0; if MesesFloat <> 12 then IdadeReal := IntToStr(Trunc(StrToFloat(AuxIdade))) + ',' + FloatToStr(MesesFloat) else begin IdadeInc := Trunc(StrToFloat(AuxIdade)); Inc(IdadeInc); IdadeReal := IntToStr(IdadeInc) + ',' + '0'; end; idadeReal:=floatToStr(trunc(StrToFloat(idadereal))); idade := IdadeReal; end;