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

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

EncodeDate

  

Encode a Year,Month,Day to a TDateTime value.

DecodeTime

  

Decode a TDateTime to a hour,minute,second,millisec quartet

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.

Documentation generated on: Jun 23 2021