Tips Trik Delphi - Hitung Abad | opxbit.web.id

Hitung Abad

Menghitung abad ke – n berdasarkan tanggal tertentu.

Deklarasi fungsi :

function HitungAbad(const d: TDate): Word;
var
  tg, bl, th: Word;
begin
  DecodeDate(D, th, bl, tg);
  Result := th div 100;
end;

Contoh implementasi :

procedure TForm1.Button1Click(Sender: TObject);
var
  d: TDate;
begin
  d:= DateTimePicker1.Date;
  with Memo1.Lines do
  begin
    Clear;
    Add('Tanggal ' + DateToStr(d) + ' berada pada abad ke - ' +
        IntToStr(HitungAbad(d)));
  end;
end;


Output:

Output - Hitung Abad

Output - Hitung Abad


Source Code Delphi - Hitung AbadDownload
Source Code Delphi - Hitung Abad
File: hitung_abad.zip
Hits: 178


VN:F [1.9.6_1107]
Rating: 5.0/5 (2 votes cast)
VN:F [1.9.6_1107]
Rating: +1 (from 1 vote)
Hitung Abad, 5.0 out of 5 based on 2 ratings


Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>