liyinwei的代码是这样?编译可通过,结果不对。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, DateUtils, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
DateTimePicker1: TDateTimePicker;
DateTimePicker2: TDateTimePicker;
Edit3: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
a,b:TDate;
begin
a:=DateTimePicker1.Date;
b:=DateTimePicker2.Date;
edit1.Text:=datetostr(a);
edit2.Text:=datetostr(b);
edit3.Text:=datetostr(DateUtils.DaysBetween(a,b));
end;
end.