Selasa, 03 Januari 2012

AplikasiKalender Digital

Nama Aplikasi : Kalender Digital Masehi dan Hijriyah
Bahasa Pemrograman : Borland Delphi 7




                                                       Gambar : tampilan muka aplikasi

Source Code
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label3: TLabel;
Timer1: TTimer;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TglHijriah(AValue: TDateTime; HijriDiff: integer=0): TDateTime;
var Y,M,D: word; Calculate,temp1,temp2,temp3: integer;
begin
DecodeDate(AValue, Y, M, D); Inc(D,HijriDiff); //mengkonversi hitungan bulan masehi ke hijriyah
if ((Y>1582) or ((Y=1582) and (M>10)) or ((Y=1582) and (M=10) and (D>14))) then
Calculate:=Trunc((1461*(Y+4800+Trunc((M-14)/12)))/4)+Trunc((366*(M-2-12*(Trunc((M-14)/12))))/12)-Trunc((3*(Trunc((Y+4900+Trunc((M-14)/12))/100)))/4)+D-32075 else Calculate:=367*Y-Trunc((7*(Y+5001+Trunc((M-9)/7)))/4)+Trunc((275*M)/9)+D+1729777;
temp1:=Calculate-1948440+10633;
temp2:=Trunc((temp1-1)/10631);
temp1:=temp1-10631*temp2+354;
temp3:=(Trunc((10985-temp1)/5316))*(Trunc((50*temp1)/17719))+(Trunc(temp1/5670))*(Trunc((43*temp1)/15238));
temp1:=temp1-(Trunc((30-temp3)/15))*(Trunc((17719*temp3)/50))-(Trunc(temp3/16))*(Trunc((15238*temp3)/43))+29;
M:=Trunc((24*temp1)/709); D:=temp1-Trunc((709*M)/24);
Y:=30*temp2+temp3-30; Result:=EncodeDate(Y,M,D);
end;
procedure TForm1.FormCreate(Sender: TObject);
var tgl:TDate; bln:String[14];
begin
Tgl:=TglHijriah(Now);
Label1.Caption:=FormatDateTime('DDDD, dd MMMM yyyy',Now)+' Masehi';
Case StrToInt(FormatDateTime('MM',tgl)) of //Membuat bulan hijriyah
1: bln:='Muharram';
2: bln:='Shafar';
3: bln:='Rabi’ul Awal';
4: bln:='Rabi’ul Akhir';
5: bln:='Jumadil Awal';
6: bln:='Jumadil Akhir';
7: bln:='Rajab';
8: bln:='Sya’ban';
9: bln:='Ramadhan';
10: bln:='Syawal';
11: bln:='Zulqaidah';
12: bln:='Zulhijjah';
End;
Label3.Caption:=FormatDateTime('dd ',tgl)+bln+FormatDateTime(' yyyy',tgl)+' Hijriyah'; // menampilkan hasil dari tanggal hijriyah
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Label2.Caption:=FormatDateTime('hh:mm:ss',Now); //menampilkan jam
end;
end.

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | free samples without surveys