From RAD Studio API Documentation
Jump to: navigation, search


function TryEncodeTime(Hour, Min, Sec, MSec: Word; out Time: TDateTime): Boolean;


extern DELPHI_PACKAGE bool __fastcall TryEncodeTime(System::Word Hour, System::Word Min, System::Word Sec, System::Word MSec, /* out */ System::TDateTime &Time);


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


Creates 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 from 0 through 24. If Hour is 24, Min, Sec, and MSec must all be 0, and the resulting TDateTime value represents midnight (12:00:00:000 A.M.) of the following day.

Valid Min and Sec values are from 0 through 59.

Valid MSec values are from 0 through 999.

The Time parameter returns the generated TDateTime value of the specifies values in range. This 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