home *** CD-ROM | disk | FTP | other *** search
- unit Dates;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, StdCtrls;
-
- type
- TDateForm = class(TForm)
- ValueEdit: TComboBox;
- FormatEdit: TComboBox;
- ResultEdit: TEdit;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- DateForm: TDateForm;
-
- implementation
-
- {$R *.DFM}
-
- procedure TDateForm.Button1Click(Sender: TObject);
- begin
- ResultEdit.Text := FormatDateTime(FormatEdit.Text, StrToDateTime(ValueEdit.Text));
- end;
-
- procedure TDateForm.FormCreate(Sender: TObject);
- begin
- with ValueEdit.Items do
- begin
- Add(DateToStr(EncodeDate(1995,1,1)) + ' 9' + TimeSeparator + '30');
- Add(DateToStr(EncodeDate(1999,12,31)) + ' 23' + TimeSeparator + '59' +
- TimeSeparator + '59');
- Add(DateToStr(EncodeDate(1998,1,1)));
- end;
- ValueEdit.Text := DateTimeToStr(Now);
- end;
-
- end.
-