Delphi Tips Trick

For Newbie

Iklan Responsive Atas

LightBlog
Responsive Ads Here

Wednesday, 16 November 2011

Calculating century - n by a certain date.

Function declaration:
centurycalculate function (const d: TDate): Word;
var
   tg, bl, th: Word;
begin
   DturecodeDate (D, th, bl, tg);
   Result: = th p 100;
end;

Example of implementation:
procedure TForm1.Button1Click (Sender: TObject);
var
   d: TDate;
begin
   d: = DateTimePicker1.Date;
   with Memo1.Lines do
   begin
     Clear;
     Add ('Date' + DateToStr (d) + 'located in the century -' +
         IntToStr (HitungAbad (d)));
   end;
end;

No comments: