From RAD Studio API Documentation
Jump to: navigation, search


function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime;


extern DELPHI_PACKAGE System::TDateTime __fastcall EncodeTime(System::Word Hour, System::Word Min, System::Word Sec, System::Word MSec);


Type Visibility Source Unit Parent
function public
System.SysUtils System.SysUtils


Returns a TDateTime value for a specified Hour, Min, Sec, and MSec.

EncodeTime encodes the given hour, minute, second, and millisecond into a TDateTime value.

Valid Hour values are 0 through 23.

Valid Min and Sec values are 0 through 59.

Valid MSec values are 0 through 999.

If the specified values are not within range, EncodeTime raises an EConvertError exception.

The resulting value is a number between 0 and 1 (inclusive) that indicates the fractional part of a day given by the specified time or (if 1.0) midnight on the following day. The value 0 corresponds to midnight, 0.5 corresponds to noon, 0.75 corresponds to 6:00 P.M., and so on.

See Also

Code Examples