unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
uses DateUtils,Math;
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
lDateTime1: TDateTime;
lDateTime2: TDateTime;
begin
lDateTime1 := 42209.125;
lDateTime2 := 42209.54166666667;
//ShowMessage(DateTimeToStr(lDateTime2));
ShowMessage(IntToStr(MinutesBetween(lDateTime1,lDateTime2)));
end;
procedure TForm1.Button2Click(Sender: TObject);
var
lDateTime1: TDateTime;
lDateTime2: TDateTime;
begin
//lDateTime1 := EncodeDateTime(2015, 07, 24, 03, 0, 0, 0);
//lDateTime2 := EncodeDateTime(2015, 07, 24, 13, 0, 0, 0);
lDateTime1 := StrToDateTime('
24.07.2015 03:00:00');
//lDateTime2 := StrToDateTime('24.07.2015 13:00:00');
lDateTime2 := RoundTo(StrToDateTime('
24.07.2015 13:00:00'),-10);
ShowMessage(FloatToStr(lDateTime1));
ShowMessage(FloatToStr(lDateTime2));
ShowMessage(IntToStr(MinutesBetween(lDateTime1,lDateTime2)));
end;