unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
DateUtils;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Head: String;
Start, Ends: String;
Split: Int64;
begin
Head := FormatDateTime('YYYY-MM-DD', now);
Start := Head + ' 19:30' + ':00';
Ends := Head + ' 20:00' + ':00';
Split := MinutesBetween(StrToDateTime(Start), StrToDateTime(Ends));
Application.MessageBox(PChar(IntToStr(Split)), '间隔时间为', MB_OK + MB_ICONINFORMATION);
end;
end.