uses DateUtils;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br> Caption := TimeBetween(Now,OldTime);<br>end;<br><br>function TForm1.TimeBetween(const ANow, AThen: TDateTime): String;<br>var<br> iSecond,iMinute,iHour,iDay: Word;<br> iSecBetween,iRe: Word;<br>begin<br> iSecBetween := SecondsBetween(ANow,AThen);<br> DivMod(iSecBetween,60,iRe,iSecond); //秒<br> DivMod(iRe,60,iRe,iMinute); //分<br> DivMod(iRe,60,iRe,iHour); //小时<br> DivMod(iRe,24,iRe,iDay); //天<br> Result := IntToStr(iDay) + '天' +<br> IntToStr(iHour) + '小时' +<br> IntToStr(iMinute) + '分' +<br> IntToStr(iSecond) + '秒';<br>end;