Ver Mensaje Individual
  #6  
Antiguo 12-07-2007
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Reputación: 25
Caral Va por buen camino
Hola
Sacado de trucomania:
Lo adapte a un DateTimePicker.
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
    function Edad(FechaNacimiento:string):integer;
  var
     iTemp,iTemp2,Nada:word;
     Fecha:TDate;
  begin
    Fecha:=StrToDate(FechaNacimiento);
    DecodeDate(Date,itemp,Nada,Nada);
    DecodeDate(Fecha,itemp2,Nada,Nada);
     if FormatDateTime('mmdd',Date) <
        FormatDateTime('mmdd',Fecha) then Result:=iTemp-iTemp2-1
                                     else Result:=iTemp-iTemp2;
  end;
begin
  Label1.Caption:=intToStr(Edad(DateToStr(DateTimePicker1.Date)));
end;
Revisalo, necesitas un DateTimePicker y un label.
Saludos
Responder Con Cita