16,749
社区成员
发帖
与我相关
我的任务
分享
procedure TForm1.Button1Click(Sender: TObject);
var subtrahend,DateTimeFirst,DateTimeLast:TDateTime;
begin
DateTimeFirst:=StrToDateTime('2013-11-11 12:23:34');
DateTimeLast:=StrToDateTime('2015-11-11 15:28:39');
subtrahend:=DateTimeLast-DateTimeFirst;
Edit1.Text:= '在线时长:' + IntToStr(Trunc(subtrahend)) + '天'
+ FormatDatetime('H"小时"m"分"s"秒"', Frac(subtrahend));
end;