Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 1
  • 2
  • 3
  • 4
  • 5
Delphide Yaş Hesaplama
#1
Selamlar
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. 
Cevapla


Bu Konudaki Yorumlar
Delphide Yaş Hesaplama - Yazar: adelphiforumz - 29-08-2018, Saat: 17:06
Cvp: Delphide Yaş Hesaplama - Yazar: ssahinoglu - 29-08-2018, Saat: 17:11
Cvp: Delphide Yaş Hesaplama - Yazar: adelphiforumz - 29-08-2018, Saat: 18:08

Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  Delphide time alanını toplama shooterman 3 537 14-09-2023, Saat: 13:03
Son Yorum: shooterman
  Resmi Tatil Hesaplama bydelphi 3 753 09-11-2022, Saat: 12:03
Son Yorum: bydelphi
  Dakika farkı hesaplama varyemez 1 655 05-05-2022, Saat: 09:57
Son Yorum: RAD Coder
  Tarih Farkı Hesaplama OZCANK 12 3.400 18-11-2021, Saat: 09:32
Son Yorum: COMMANDX
  TIdFtp Toplam Kullanılan Alan Hesaplama Hakkında Yardım glagher 7 1.707 07-11-2021, Saat: 16:02
Son Yorum: mrmarman



Konuyu Okuyanlar: 1 Ziyaretçi