procedure TForm1.Button1Click(Sender: TObject); var time1,time2,ptime, msecday : TTimeStamp; //msecday1 : Double; itmp1, tmp1,tmp2,tmp3, tmp4,tmp5,tmp6,tmp7 : integer; begin //msecday1 := (1/(24*60*60)); time1 := DateTimeToTimeStamp(StrToDateTime('2000-02-02 02:50:00')); time2 := DateTimeToTimeStamp(StrToDateTime('2000-02-03 05:51:20')); ptime.Time := time2.Time - time1.Time; ptime.Date := time2.Date - time1.Date; if ptime.Time < 0 then begin Dec(ptime.Date); ptime.Time := MSecsPerDay + ptime.Time; end; edit2.Text := IntToStr(ptime.date * MSecsPerDay + ptime.Time); itmp1 := StrToInt(edit2.Text); //msec itmp1 := Trunc(itmp1/1000); tmp1 := itmp1 div 86400; //day tmp2 := itmp1 mod 86400; tmp3 := tmp2 div 3600; //HH tmp4 := tmp2 mod 3600; tmp5 := tmp4 div 60; //NN tmp6 := tmp4 mod 60; //ss edit3.Text := IntToStr(tmp1)+'일'+IntToStr(tmp3)+'시간'+IntToStr(tmp5)+'분'+ IntToStr(tmp6)+'초'; end;
두 날짜 뺀후 결과 msec 출력.
해당 msec를 날짜 시간 분 초로 구분...
원문1 : http://newworlds.tistory.com/618