Convert an Amount of Microseconds into a TDateTime Value
uses DateUtils; function MicrosecondsToTime(const microSeconds : TLargeInteger) : string; CONST MicroPerMilli = 1000; var dt : TDateTime; microSec : TLargeInteger; begin dt := microSeconds / MicroPerMilli / MSecsPerSec / SecsPerDay; microSec := microseconds - MicroPerMilli * MilliSecondOf(dt) ; if microsec < 0 then begin dt := IncMilliSecond(dt,-1) ; microsec := MicroPerMilli + microsec; end; result := Format('%d days, %s %d', FormatDateTime[/link">('hh:nn:ss.z', Frac(dt)), microSec]) ; end;
Convert Milliseconds to Days and Time
function MSecToTime(mSec: Int64): string; var dt : TDateTime; begin dt := mSec / MSecsPerSec / SecsPerDay; Result := Format('%d days, %s', ) ; end;