Get the Century of a date  

Send By: Radikal (Q3 Team)
Web : http://www.q3.nu
Email: radikal@q3.nu
Date: 20/09/20

Tip accessed 497 times

 



 procedure TForm1.Button1Click(Sender: TObject);

   function SigloDeFecha(const Fecha: TDateTime): Integer;
   var
     D,M,A: Word;
   begin
     DecodeDate(Fecha,A,M,D);
     if A > 0 then
       Result := (A div 100) + 1
     else
       Result := (A div 100) - 1;
   end;
 begin
   Caption:=IntToStr(
                      SigloDeFecha( StrToDate('23/08/2001') )
                     ) ;
 end;




Sent by: mescobar@super-de-alimentos.com



 procedure TForm1.Button1Click(Sender: TObject);

   function SigloDeFecha(const Fecha: TDateTime): Integer;
   var
     D,M,A: Word;
   begin
     DecodeDate(Fecha,A,M,D);
     Result := (A div 100) + (A div Abs(A));
   end;

 begin
   Caption:=IntToStr(SigloDeFecha( StrToDate('23/08/2001'))) ;
 end;




Updated at 20/09/2002