ANA SAYFA
İÇİNDEKİLER
PROSEDÜR
=> Örnek1
=> Örnek2
=> Örnek3
=> Örnek4
=> Örnek5
=> Örnek6
=> Örnek7
=> Örnek8
=> Örnek9
=> Örnek10
=> Örnek11
=> Örnek12
=> Örnek13
=> Örnek14
=> Örnek15
=> Örnek16
=> Örnek17
=> Örnek18
=> Örnek19
=> Örnek20
=> Örnek21
=> Örnek22
=> Örnek23
=> Örnek24
=> Örnek25
FONKSİYON
İSTATİSTİK
Z. DEFTERİ
İLETİŞİM
Örnek21

Soru = Klavyeden girilen İlk ve son tarih arasında tarih farkını alarak gün sayısını veren programı prosedürde yapınız.

Şekli :

Image Hosted by ImageShack.us

Kodlar :
Procedure tarih(tarih1,tarih2:tdate); 
var 
sonuc:integer;
bos,date1,date2:tdate; gun1,ay1,yil1,gun2,ay2,yil2,difference:Integer;
begin 
gun1:=strtoint(copy(Datetostr(tarih1),1,2));
ay1:=strtoint(copy(Datetostr(tarih1),4,2));
yil1:=strtoint(copy(Datetostr(tarih1),7,4));
gun2:=strtoint(copy(Datetostr(tarih2),1,2));
ay2:=strtoint(copy(Datetostr(tarih2),4,2));
yil2:=strtoint(copy(Datetostr(tarih2),7,4));
date1 := EncodeDate(yil2, ay2, gun2);
date2 := EncodeDate(yil1, ay1, gun1);
difference := trunc(date1) - trunc(date2);
if difference<0 then
begin 
difference:=difference*-1;
showmessage('Tarih Farkının Sonucu : '+inttostr(difference)+ ' Gündür');
end 
else
showmessage('Tarih Farkı : '+inttostr(difference)+ ' Gündür');
end; 

Procedure TForm1.Button1Click(Sender: TObject); 
Var 
ilk1,son1:tdate;
begin 
ilk1:=strtodate(edit1.text);
son1:=strtodate(edit2.text);
tarih(ilk1,son1);
end; 

Çalışma Şekli : 

Image Hosted by ImageShack.usImage Hosted by ImageShack.us 

Klavyeden şekilde görüldüğü gibi tarih formatında ilk ve son tarih değerleri girildiğinde ekrana iki tarihin farkını gün olarak verir.  

 

Hakkında
Bu tasarım PINAR ÖZER tarafından sistem analizi dersi için verilen proje kapsamında yapılmıştır.
Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol