Sign in Join
FPDoc Onlineexperiment

EncodeTime function

In unit sysutils

Encode a Hour,Min,Sec,millisec to a TDateTime value.

Declaration

pascal
function EncodeTime(Hour: Word; Minute: Word; Second: Word; 
 MilliSecond: Word): TDateTime

Description

EncodeTime encodes the Hour, Minute, Second, MilliSecond variables to a TDateTime format result. It does the opposite of the DecodeTime procedure.

The parameters must have a valid range (boundaries included):

Hour
must be between 0 and 23.
Minute,second
must both be between 0 and 59.
Millisecond
must be between 0 and 999.

Errors

In case one of the parameters is out of it's valid range, an EConvertError exception is raised.

See also

Example: ex12

pascal
Program Example12;

{ This program demonstrates the EncodeTime function }

Uses sysutils;

Var Hh,MM,SS,MS : Word;

Begin
  DeCodeTime (Time,Hh,MM,SS,MS);
  Writeln ('Present Time is : ',FormatDateTime('hh:mm:ss',EnCodeTime (HH,MM,SS,MS)));
End.

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