29-08-2018, Saat: 17:06
Selamlar
Eskiden kullandığım yaş hesaplama fonksiyonu örnek haline getirdim
belki birinin işine yarar
.pas
.dfm
Eskiden kullandığım yaş hesaplama fonksiyonu örnek haline getirdim
belki birinin işine yarar
.pas
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, dateutils, Vcl.ComCtrls; type TForm1 = class(TForm) btnHesapla: TButton; lblSonuc: TLabel; DTP_Bas: TDateTimePicker; Label2: TLabel; Label3: TLabel; DTP_Bit: TDateTimePicker; procedure btnHesaplaClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.btnHesaplaClick(Sender: TObject); var d0, dx :TDateTime; y, a, g:Word; begin d0 := EncodeDate(1, 1, 1); dx := (DTP_Bit.Date-DTP_Bas.Date); dx := d0+dx; DecodeDate(dx, y, a, g); lblSonuc.Caption := 'Yıl:' + IntToStr(y-1) + ' Ay: ' + IntTostr(a-1) + ' Gün:' + IntToStr(g-1); end; end.
.dfm
object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 160 ClientWidth = 337 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object lblSonuc: TLabel Left = 134 Top = 112 Width = 39 Height = 13 Caption = 'lblSonuc' end object Label2: TLabel Left = 56 Top = 16 Width = 72 Height = 13 Caption = 'Do'#287'um Tarihi : ' end object Label3: TLabel Left = 56 Top = 43 Width = 30 Height = 13 Caption = 'Bug'#252'n' end object btnHesapla: TButton Left = 134 Top = 67 Width = 75 Height = 25 Caption = 'Hesapla' TabOrder = 0 OnClick = btnHesaplaClick end object DTP_Bas: TDateTimePicker Left = 134 Top = 13 Width = 97 Height = 21 Date = 43341.706393969910000000 Time = 43341.706393969910000000 TabOrder = 1 end object DTP_Bit: TDateTimePicker Left = 134 Top = 40 Width = 97 Height = 21 Date = 43341.706393969910000000 Time = 43341.706393969910000000 TabOrder = 2 end end
Bu dünyada kendine sakladığın bilgi ahirette işine yaramaz.