Sign in Join
FPDoc Onlineexperiment

RecodeMilliSecond function

In unit DateUtils

Replace milliseconds part of a TDateTime value with another millisecond.

Declaration

pascal
function RecodeMilliSecond(const AValue: TDateTime; 
 const AMilliSecond: Word): TDateTime

Arguments

AValue

Date/time to recode.

AMilliSecond

Millisecond to replace in AValue.

Function result

AValue with replaced millisecond.

Description

RecodeMilliSecond replaces the millisecond part of the timestamp AValue with AMilliSecond. All other parts of the date/time stamp are left untouched.

Errors

If the AMilliSecond value is not within a valid range (0..999) then an EConvertError exception is raised.

See also

Example: ex93

pascal
Program Example93;

{ This program demonstrates the RecodeMilliSecond function }

Uses SysUtils,DateUtils;

Const
  Fmt = 'dddd dd mmmm yyyy hh:nn:ss.zzz';

Var
  S : AnsiString;

Begin
  S:=FormatDateTime(Fmt,RecodeMilliSecond(Now,0));
  Writeln('This moment, milliseconds stripped : ',S);
End.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.