Home > Back-end >  Two date/time is presupposed, and the calculation of online time
Two date/time is presupposed, and the calculation of online time

Time:09-25

Two date/time is presupposed, and the calculated login online time, the code for the truth!!!!!!
The system which is suitable for the current time, DateTime gdLoginDateTime login time
Var dtOnlineDateTime: TDateTime;
The begin
If DateTimeToStr (gdLoginDateTime) & lt;> '1899-12-30' then
The begin
DtOnlineDateTime:=DateTime - gdLoginDateTime;
LblOnlineTime. Caption:='online time: + IntToStr (Trunc (dtOnlineDateTime)) +' day '
+ FormatDatetime (" H "hour" m "points" s "seconds" ', Frac (dtOnlineDateTime));
end;
end;

CodePudding user response:

So, will manage well understood:
 
Procedure TForm1. Button1Click (Sender: TObject);
Var subtrahend, DateTimeFirst DateTimeLast: TDateTime;
The begin
DateTimeFirst:=StrToDateTime (' 2013-11-11 12:23:34);
DateTimeLast:=StrToDateTime (' 15:28:39 2015-11-11 ');
Subtrahend:=DateTimeLast - DateTimeFirst;
Edit1. Text:='online time: + IntToStr (Trunc (subtrahend)) +' day '
+ FormatDatetime (" H "hour" m "points" s "seconds" ', Frac subtrahend ());
end;
  • Related