[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'sysutils' (#rtl)

MSecsToTimeStamp

Convert a number of milliseconds to a TDateTime value.

Declaration

Source position: datih.inc line 105

function MSecsToTimeStamp(

  MSecs: Comp

):TTimeStamp;

Description

MSecsTiTimeStamp converts the given number of milliseconds to a TTimeStamp date/time notation.

Use TTimeStamp variables if you need to keep very precise track of time.

Errors

None.

See also

TimeStampToMSecs

  

Converts a timestamp to a number of milliseconds.

DateTimeToTimeStamp

  

Converts a TDateTime value to a TimeStamp structure.

Example

Program Example17;

{ This program demonstrates the MSecsToTimeStamp function }

Uses sysutils;

Var MS : Comp;
    TS : TTimeStamp;
    DT : TDateTime;
Begin
  TS:=DateTimeToTimeStamp(Now);
  Writeln ('Now in days since 1/1/0001      : ',TS.Date);
  Writeln ('Now in millisecs since midnight : ',TS.Time);
  MS:=TimeStampToMSecs(TS);
  Writeln ('Now in millisecs since 1/1/0001 : ',MS);
  MS:=MS-1000*3600*2;
  TS:=MSecsToTimeStamp(MS);
  DT:=TimeStampToDateTime(TS);
  Writeln ('Now minus 1 day : ',DateTimeToStr(DT));
End.
The latest version of this document can be found at lazarus-ccr.sourceforge.net.