EncodeTime

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

Declaration

Source position: datih.inc line 120

  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

Name Description
DecodeTime Decode a TDateTime to a hour,minute,second,millisec quartet
EncodeDate Encode a Year,Month,Day to a TDateTime value.

Example

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.

results matching ""

    No results matching ""