DATETIMEPICKER DELPHI Sasa Ani Arnomo S Kom M






- Slides: 6
DATETIMEPICKER DELPHI Sasa Ani Arnomo, S. Kom, . M. S. I
function ganti(Tanggal: TDate): String; procedure TForm 1. Button 1 Click(Sender: TObject); const begin n. Hari: array[1. . 7] of String = with Memo 1. Lines do ('Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jum''at', begin 'Sabtu'); Clear; n. Bulan: array[1. . 12] of String = ('Januari', 'Februari', 'Maret', 'April', 'Mei', ', 'Oktober', 'Juni', 'Juli', 'Agustus', 'September 'November', 'Desember'); var thn, bln, tgl: Word; begin Decode. Date(Tanggal, thn, bln, tgl); Result: = n. Hari[Day. Of. Week(Tanggal)] + ', ' + Int. To. Str(tgl) + ' ' + n. Bulan[bln] + ' ' + Int. To. Str(thn); end; Decode. Date Add(ganti(Date. Time. Picker 1. Date)); end; label 1. Caption: = ganti(Date. Time. Picker 1. Date); end;
type r. Date = record c. Tanggal: Byte; c. Bulan: Byte; c. Tahun: Integer; end; procedure TForm 3. Button 1 Click(Sender: TObject); var D: r. Date; begin D: = Pisah. Tanggal(Date. Time. Picker 1. Date); with Memo 1. Lines do function Pisah. Tanggal(Tanggal: TDate): r. Date; var tgl, bln, thn: Word; begin Decode. Date(Tanggal, thn, bln, tgl); with Result do begin c. Tanggal: = tgl; c. Bulan: = bln; c. Tahun: = thn; end; Decode. Date begin Clear; Add('Tanggal = ' + Int. To. Str(D. c. Tanggal)); Add('Bulan = ' + Int. To. Str(D. c. Bulan)); Add('Tahun = ' + Int. To. Str(D. c. Tahun)); end;
procedure TForm 2. BHitung. Click(Sender: TObject); var i: integer; begin for i: = 1 to 365 do begin if datetostr(tgl_pinjam. Date. Time + i)=datetostr(tgl_kembali. Date. Time) then Elama. Text: =inttostr(i); end; Date. To. Str
function Selisih. Tanggal(Tgl. Old, Tgl. New: TDate): Integer; begin Result: = Trunc(Tgl. New - Tgl. Old); end; procedure TForm 2. Button 1 Click(Sender: TObject); begin Edit 1. Text: = Int. To. Str(Selisih. Tanggal(Date. Time. Picker 1. Date, Date. Timepicker 2. Date)); end; TRUNC
LATIHAN