📄 inputdatetimeunit.pas
字号:
unit InputDateTimeUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ComCtrls, ExtCtrls;
type
TGetTimeForm = class(TForm)
DateMC: TMonthCalendar;
Panel1: TPanel;
TimeDTP: TDateTimePicker;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
GetTimeForm: TGetTimeForm;
function GetMyDateTime:TDateTime; stdcall;
implementation
{$R *.dfm}
function GetMyDateTime:TDateTime ;
var
Temp:string;
begin
result:=Now;
try
GetTimeForm := TGetTimeForm.Create (Application);
try
with GetTimeForm do
begin
if ShowModal = mrOK then
begin
Temp:=DateToStr(DateMC.Date)+' '+TimeToStr(TimeDTP.Time);
Result:=StrToDateTime(Temp);
end;
end;
finally
GetTimeForm.Free;
end;
except
on E: Exception do
MessageDlg ('DLL出现错误:'+E.Message, mtError,[mbOK],0);
end;
end;
procedure TGetTimeForm.FormCreate(Sender: TObject);
begin
DateMC.Date:=Now;
TimeDTP.Time:=Now;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -